Skip to content

Commit 3252843

Browse files
committed
πŸ’š Fix logic gaps
A tag push triggered all 3 workflows when it should only trigger prerelease or release workflows.
1 parent 6ce610c commit 3252843

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

β€Ž.github/workflows/_publish-gem.ymlβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ jobs:
107107
- name: Publish GitHub Release
108108
uses: softprops/action-gh-release@v2
109109
with:
110+
draft: true # Temporary for testing
110111
prerelease: ${{ inputs.prerelease }}
111112
files: ceedling-*.gem
112113

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
---
3232
name: CI
3333

34-
# Triggers the workflow on push to any branch, pull requests targeting master,
35-
# or manual dispatch
34+
# Triggers the workflow on push to any branch (tag pushes excluded β€” handled by
35+
# prerelease.yml and release.yml), pull requests targeting master, or manual dispatch
3636
on:
37-
push: # All branches β€” no branch filter; see Skip-CI above
37+
push:
38+
branches:
39+
- '**' # All branches; branches: ['**'] scopes push to refs/heads/ only,
40+
# excluding refs/tags/ pushes β€” see Skip-CI above
3841
pull_request:
3942
branches: [master]
4043
workflow_dispatch:

β€Ž.github/workflows/release.ymlβ€Ž

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,15 @@
4141
---
4242
name: Release
4343

44-
# Triggers on release tag pattern; see 'if' guard on publish job for the
45-
# second line of defense against pre-release tags matching this glob
44+
# Triggers on release tag pattern only.
45+
# Primary defense: the negative pattern '!v*.*.*-*' excludes any tag containing
46+
# a hyphen (e.g. v1.0.0-pre.1), which would otherwise match the v*.*.* glob.
47+
# Fallback defense: the 'if' guard on the publish job also rejects hyphenated tags.
4648
on:
4749
push:
4850
tags:
4951
- 'v*.*.*'
52+
- '!v*.*.*-*' # Exclude pre-release tags (e.g. v1.0.0-pre.1, v1.0.0-beta.1)
5053

5154

5255
# contents: write is required to create and upload GitHub releases

0 commit comments

Comments
Β (0)