Second draft #3
Workflow file for this run
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: PR Review Checks | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| pull_request_review: | ||
| types: [submitted] | ||
| pull_request_review_comment: | ||
| types: [created, deleted] | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| jobs: | ||
| pr-review-checks: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check Copilot has reviewed and all comments resolved | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const prNumber = context.issue.number || context.payload.pull_request.number; | ||
| // Check if Copilot has reviewed the PR | ||
| const reviews = await github.paginate(github.rest.pulls.listReviews, { | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: prNumber, | ||
| per_page: 100, | ||
| }); | ||
| const copilotReviewed = reviews.some( | ||
| r => r.user.login === 'Copilot' || r.user.login === 'github-copilot[bot]' | ||
| ); | ||
| if (!copilotReviewed) { | ||
| core.setFailed('Copilot has not reviewed this PR yet.'); | ||
| return; | ||
| } | ||
| core.info('✅ Copilot has reviewed this PR.'); | ||