Skip to content

Second draft

Second draft #3

name: PR Review Checks

Check failure on line 1 in .github/workflows/pr-review-checks.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/pr-review-checks.yaml

Invalid workflow file

(Line: 11, Col: 3): Unexpected value 'permissions'
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.');