Enhance bugbot trigger conditions in workflow #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pull Request | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| bugbot_enabled: | ||
| description: 'Enable BugBot review' | ||
| type: boolean | ||
| required: false | ||
| default: true | ||
| jobs: | ||
| trigger-bugbot: | ||
| runs-on: ubuntu-latest | ||
| if: ${{ | ||
| inputs.bugbot_enabled && | ||
| !github.event.pull_request.draft && | ||
| github.event_name == 'pull_request' && | ||
| contains(fromJson('["opened", "reopened", "synchronize"]'), github.event.action) | ||
| }} | ||
| steps: | ||
| - name: Validate PAT | ||
| env: | ||
| PAT: ${{ secrets.PERSONAL_ACCESS_TOKEN_ADRIAAN_ISSUES }} | ||
| run: | | ||
| if [[ "$PAT" != github_pat_* ]]; then | ||
| echo "::error::PERSONAL_ACCESS_TOKEN_ADRIAAN_ISSUES is not set or is not a valid fine-grained PAT (must start with github_pat_)" | ||
| exit 1 | ||
| fi | ||
| - name: Comment to trigger BugBot | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN_ADRIAAN_ISSUES }} | ||
| script: | | ||
| const comment = await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: '@cursor review' | ||
| }) | ||
| await github.graphql(` | ||
| mutation MinimizeComment($id: ID!) { | ||
| minimizeComment(input: { subjectId: $id, classifier: OUTDATED }) { | ||
| minimizedComment { isMinimized } | ||
| } | ||
| } | ||
| `, { id: comment.data.node_id }) | ||