Skip to content

Commit cb71dd9

Browse files
committed
test(ci): fully-qualify throwaway push refspec (fix detached-HEAD push)
1 parent 840d967 commit cb71dd9

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/test-pat-validation.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ jobs:
4343
# captured when this test was written. The push to `main` in release.yaml
4444
# succeeds only if the PAT owner is one of these logins.
4545
BYPASS_ROSTER: "CRThaze darenjacobs thalesac jms200 CometActions"
46-
TEST_BRANCH: "pat-validate/${{ github.run_id }}"
46+
# Single-component name; the push step fully-qualifies it to a refspec.
47+
# (A slashed name like pat-validate/<id> makes git refuse to push HEAD
48+
# from the detached-HEAD checkout a pull_request run produces.)
49+
TEST_BRANCH: "pat-validate-${{ github.run_id }}"
4750
steps:
4851
- name: Checkout
4952
uses: actions/checkout@v4
@@ -129,7 +132,9 @@ jobs:
129132
uses: ad-m/github-push-action@master
130133
with:
131134
github_token: ${{ secrets.GH_PAT_TO_ACCESS_GITHUB_API }}
132-
branch: ${{ env.TEST_BRANCH }}
135+
# Fully-qualified so git does not have to "guess" the ref (which fails
136+
# on a detached HEAD). This is HEAD:refs/heads/pat-validate-<id>.
137+
branch: refs/heads/${{ env.TEST_BRANCH }}
133138
force: false
134139

135140
- name: 6. Delete throwaway branch (cleanup)

0 commit comments

Comments
 (0)