-
Notifications
You must be signed in to change notification settings - Fork 13
Fix pull request secret scanning by using GITHUB_HEAD_REF to scan PR commits #89
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: main
Are you sure you want to change the base?
Conversation
Co-authored-by: DariuszPorowski <[email protected]>
|
@copilot perform a few tests on |
Verified ✓ Both approaches produce identical SHA values when they work. Test Results:
Key Finding:
|
|
@copilot under checks, runs show |
Co-authored-by: DariuszPorowski <[email protected]>
Fixed in 8e37582. The issue was
Now using |
The action fails on pull requests with
fatal: ambiguous argument 'refs/remotes/pull/123/merge': unknown revision or path not in the working tree.Changes
refs/remotes/origin/${GITHUB_HEAD_REF}to get the actual PR head commit instead ofgit rev-list --no-merges -n 1 "refs/remotes/pull/${GITHUB_REF_NAME}"pull_request_targetsupport alongsidepull_requestWhy
The original code tried to resolve
refs/remotes/pull/${GITHUB_REF_NAME}which doesn't exist in the checkout.Additionally,
GITHUB_SHApoints to different commits depending on the event type:Using
GITHUB_HEAD_REF(the PR branch name) allows us to resolve the actual PR head commit viarefs/remotes/origin/${GITHUB_HEAD_REF}, which correctly scans exactly the PR commits for both event types.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.