[DON'T MERGE] Test comment triggered CI #70
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: Router Submission Evaluation Trigger | |
| on: | |
| issue_comment: | |
| types: [created] | |
| jobs: | |
| request-evaluation: | |
| if: >- | |
| github.event.issue.pull_request && | |
| startsWith(github.event.comment.body, '/evaluate') && | |
| ( | |
| github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'COLLABORATOR' || | |
| github.event.comment.user.login == github.event.issue.user.login | |
| ) | |
| runs-on: self-hosted | |
| permissions: | |
| actions: write | |
| issues: write | |
| pull-requests: write | |
| checks: write | |
| contents: read | |
| steps: | |
| - name: Acknowledge /evaluate command | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| try { | |
| await github.rest.reactions.createForIssueComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: context.payload.comment.id, | |
| content: 'eyes' | |
| }); | |
| } catch (error) { | |
| // Some org/repo token policies disallow reactions for GITHUB_TOKEN. | |
| // Do not block evaluation trigger on this cosmetic action. | |
| if (error.status === 403) { | |
| core.warning(`Skipping reaction due to permission restriction: ${error.message}`); | |
| } else { | |
| throw error; | |
| } | |
| } | |
| - name: Fetch PR details | |
| id: pr | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const pr = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.payload.issue.number | |
| }); | |
| core.setOutput('number', String(pr.data.number)); | |
| core.setOutput('base_ref', pr.data.base.ref); | |
| core.setOutput('base_sha', pr.data.base.sha); | |
| - name: Dispatch evaluation workflow | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| await github.rest.actions.createWorkflowDispatch({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: 'pr-evaluation-run.yml', | |
| ref: '${{ steps.pr.outputs.base_ref }}', | |
| inputs: { | |
| pr_number: '${{ steps.pr.outputs.number }}', | |
| base_ref: '${{ steps.pr.outputs.base_ref }}', | |
| base_sha: '${{ steps.pr.outputs.base_sha }}' | |
| } | |
| }); |