Skip to content

Commit 8b028c6

Browse files
authored
ci: fetch annotated tag object in release workflow (#3)
actions/checkout at a tag-push ref materializes the tag as a lightweight ref on the runner unless fetch-tags is set, so git tag -l --format='%(contents:subject)' "$tag" returns nothing and the workflow falls back to the commit subject. For squash-merged release PRs that subject is the auto-generated "Release vX.Y.Z - ... (#N)" line, which is not what we want as a release title. Setting fetch-tags: true pulls the annotated tag object, so the subject resolves to the message we pass via `git tag -a -m`. Co-authored-by: Przemysław Szypowicz <2733699+pszypowicz@users.noreply.github.com>
1 parent 4e3af94 commit 8b028c6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
22+
# Fetch the annotated tag object itself, not just the commit it
23+
# points at. Without this the tag is materialized as lightweight
24+
# on the runner and `git tag -l --format='%(contents:subject)'`
25+
# falls back to the commit subject - which for squash-merged PRs
26+
# carries the "(#N)" suffix GitHub auto-appends.
27+
with:
28+
fetch-tags: true
2229

2330
- name: Publish release
2431
env:

0 commit comments

Comments
 (0)