Skip to content

Commit 333eeb4

Browse files
committed
ci: make tag workflow robust for non-release commits
1 parent 80ee22f commit 333eeb4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/tag-release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,26 @@ permissions:
1111
jobs:
1212
tag:
1313
runs-on: ubuntu-latest
14-
if: startsWith(github.event.head_commit.message, 'chore(release): v')
1514
steps:
1615
- name: Checkout
1716
uses: actions/checkout@v4
1817
with:
1918
fetch-depth: 0
2019

21-
- name: Create and push tag
20+
- name: Create and push tag for release commits
2221
run: |
22+
MESSAGE="${{ github.event.head_commit.message }}"
23+
if [[ "$MESSAGE" != chore\(release\):\ v* ]]; then
24+
echo "Not a release commit; skipping"
25+
exit 0
26+
fi
27+
2328
VERSION="v$(node -p \"require('./package.json').version\")"
2429
if git ls-remote --tags origin | grep -q "refs/tags/${VERSION}$"; then
2530
echo "Tag ${VERSION} already exists; skipping"
2631
exit 0
2732
fi
33+
2834
git config user.name "github-actions[bot]"
2935
git config user.email "github-actions[bot]@users.noreply.github.com"
3036
git tag "${VERSION}" -m "Release ${VERSION}"

0 commit comments

Comments
 (0)