Skip to content

Commit 0564115

Browse files
committed
Release trigger tightening
1 parent fa9b2de commit 0564115

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

.github/workflows/release_main.yaml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ on:
3333
permissions:
3434
contents: write
3535

36+
# Serialize releases so two pushes landing close together can't both read the same
37+
# latest tag and race to create it. cancel-in-progress: false queues the later run
38+
# (every push is a distinct release to cut) rather than cancelling the in-flight one.
39+
concurrency:
40+
group: release-main
41+
cancel-in-progress: false
42+
3643
jobs:
3744
release:
3845
runs-on: ubuntu-latest
@@ -63,11 +70,21 @@ jobs:
6370
exit 0
6471
fi
6572
66-
# Resolve the bump level from the (merge) commit message; default patch.
73+
# Resolve the bump level. Conventional Commits puts the <type>/<type>!: prefix on
74+
# the SUBJECT (first line); BREAKING CHANGE is an uppercase footer on its own line.
75+
# We match accordingly so prose can't force a bump — e.g. "docs: mention a breaking
76+
# change", or a squash-merge body that concatenates every PR bullet, no longer trips
77+
# a major. The [major]/[minor] tags remain deliberate escape hatches and may appear
78+
# anywhere in the message. Default is patch.
79+
SUBJECT="$(printf '%s' "$HEAD_COMMIT_MSG" | head -n1)"
80+
6781
LEVEL="patch"
68-
if printf '%s' "$HEAD_COMMIT_MSG" | grep -qiE 'BREAKING CHANGE|\[major\]|(^|[^a-z])[a-z]+(\([^)]*\))?!:'; then
82+
if printf '%s' "$SUBJECT" | grep -qE '^[a-z]+(\([^)]*\))?!:' \
83+
|| printf '%s' "$HEAD_COMMIT_MSG" | grep -qE '^BREAKING[ -]CHANGE:' \
84+
|| printf '%s' "$HEAD_COMMIT_MSG" | grep -qiE '\[major\]'; then
6985
LEVEL="major"
70-
elif printf '%s' "$HEAD_COMMIT_MSG" | grep -qiE '\[minor\]|(^|[^a-z])feat(\([^)]*\))?:'; then
86+
elif printf '%s' "$SUBJECT" | grep -qE '^feat(\([^)]*\))?:' \
87+
|| printf '%s' "$HEAD_COMMIT_MSG" | grep -qiE '\[minor\]'; then
7188
LEVEL="minor"
7289
fi
7390
echo "Bump level resolved from commit message: ${LEVEL}"

0 commit comments

Comments
 (0)