fix: use commit SHA for autofix checkout to survive deleted PR branches#741
Merged
Bryan-Roe merged 4 commits intoJul 6, 2026
Merged
Conversation
Contributor
Author
|
@Bryan-Roe Unfortunately, I hit an error while trying to use the custom Copilot setup steps configured for this repository and had to close this PR. The error I am seeing is: Once you or someone with the necessary access fixes the problem, please unassign and then reassign issue #0 to me and I'll retry. Thanks! |
The "Auto-fix (lint / format)" job in codeql.yml failed when the PR branch (chunk/add-docstrings-key-functions) was deleted before the workflow's checkout step ran. The job used the branch name as the checkout ref, which fails if the branch no longer exists. Fix: use PR_HEAD_SHA (commit SHA) for the checkout ref — the commit object persists even after branch deletion. Add a separate push_ref output (branch name) used only by the git push step, so the push still targets the correct branch when it exists. Also add a test to guard the new contract.
If the PR branch is deleted between checkout and push (e.g. auto-deleted after merge), ls-remote now detects the missing ref and skips the push with a clear message instead of failing the step. Also update test to match new PUSH_REF env var pattern.
Copilot
AI
changed the title
[WIP] Fix the failing GitHub Actions job auto-fix (lint / format)
fix: use commit SHA for autofix checkout to survive deleted PR branches
Jul 6, 2026
Contributor
There was a problem hiding this comment.
Sorry @Bryan-Roe, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
…er-one Signed-off-by: Bryan <74067792+Bryan-Roe@users.noreply.github.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Auto-fix (lint / format)job incodeql.ymlhard-fails when the PR branch is deleted (e.g. auto-deleted after merge) beforeactions/checkoutruns — it tries to resolve the branch name, which no longer exists.Changes
PR_HEAD_SHAenv var to the "Determine checkout ref" step; forpull_requesteventsrefnow outputs the commit SHA. Commit objects are immutable and persist after branch deletion.push_refoutput — branch name is preserved in a newpush_refoutput used exclusively by the push step, so the autofix commit still lands on the correct branch when it exists.git ls-remote --exit-codechecks the remote ref before pushing; if the branch was deleted between checkout and push, the step skips with a clear message instead of erroring.test_codeql_autofix_uses_sha_for_checkout_and_branch_for_pushadded totest_codeql_workflow_paths_ignore.pyto pin the contract.