Skip to content

Commit 66126ad

Browse files
committed
fix: skip tag-annotation fetch step on workflow_dispatch
The 'Get Tag Annotations' step runs: git fetch -f origin ${{ github.ref }}:${{ github.ref }} When the workflow is triggered manually (workflow_dispatch), github.ref resolves to refs/heads/main. Git refuses to fetch into a branch that is already checked out, exiting with code 128. The fetch is only meaningful for tag-triggered runs (it retrieves annotated tag metadata that the shallow checkout misses). Add an 'if: startsWith(github.ref, "refs/tags/")' condition so the step is skipped entirely on manual dispatch triggers.
1 parent bdb8525 commit 66126ad

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ jobs:
2424
fetch-tags: true
2525

2626
# See https://github.com/actions/checkout/issues/290
27+
# Only needed for tag-triggered runs; fetching a branch ref into the
28+
# checked-out branch causes git to refuse with exit code 128.
2729
- name: "Get Tag Annotations"
30+
if: startsWith(github.ref, 'refs/tags/')
2831
run: git fetch -f origin ${{ github.ref }}:${{ github.ref }}
2932

3033
- name: "Setup"

0 commit comments

Comments
 (0)