-
-
Notifications
You must be signed in to change notification settings - Fork 244
Updated CI so Copilot-created PRs can start without waiting for manual workflow approval #978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,29 +1,37 @@ | ||||||
| name: Build with Tests | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| workflow_dispatch: | ||||||
| pull_request: | ||||||
| types: [opened, edited] | ||||||
| on: | ||||||
| push: | ||||||
| workflow_dispatch: | ||||||
| pull_request: | ||||||
| types: [opened, synchronize, reopened, edited] | ||||||
| pull_request_target: | ||||||
| types: [opened, synchronize, reopened, edited] | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
|
|
||||||
| jobs: | ||||||
| build_and_test_Windows: | ||||||
| name: "Windows: Build and Tests" | ||||||
| if: ${{ github.event_name != 'pull_request_target' || startsWith(github.actor, 'copilot') || github.actor == 'github-copilot[bot]' }} | ||||||
|
||||||
| runs-on: windows-latest | ||||||
|
|
||||||
| env: | ||||||
| IsRunningOnGitHubActions: 'true' | ||||||
| UseInMemory: 'true' | ||||||
|
|
||||||
| steps: | ||||||
| steps: | ||||||
| - uses: actions/checkout@v4 | ||||||
| with: | ||||||
| fetch-depth: 0 | ||||||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||||||
|
||||||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} |
Outdated
Check failure
Code scanning / SonarCloud
Workflows should not rely on unverified GitHub context values to trust events High
Outdated
Check failure
Code scanning / SonarCloud
Workflows should not rely on unverified GitHub context values to trust events High
Outdated
Copilot
AI
Mar 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The job gate for pull_request_target is spoofable: startsWith(github.actor, 'copilot') would allow any user with a username like copilot-foo to run this workflow in the privileged pull_request_target context. Restrict this to an explicit allow-list of the exact bot account(s) (or a non-spoofable identifier like a known actor_id) to avoid a security bypass.
Outdated
Copilot
AI
Mar 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actions/checkout now always checks out github.event.pull_request.head.sha for pull_request runs, which changes CI from testing the PR merge commit to testing only the PR head commit. That can miss integration failures that would occur after merging. Consider only overriding ref for pull_request_target runs (and keep the default merge ref for pull_request).
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow triggers on both
pull_requestandpull_request_target. For Copilot-authored PRs, the jobs will run for both events (because the jobifpasses forpull_requestand forpull_request_target), which can create duplicate CI runs and may still leave a blockedpull_requestrun “waiting for approval”. If the intent is to run only viapull_request_targetfor Copilot, add a complementary skip condition for thepull_requestevent (or split into separate workflows).