Skip to content

Commit f55dd0e

Browse files
committed
chore: ensure release merge is correct
1 parent e83c493 commit f55dd0e

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

.github/workflows/publish.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,32 @@ name: Publish to npm
22

33
on:
44
workflow_dispatch:
5-
pull_request:
6-
types: [closed]
5+
push:
76
branches: [main]
7+
paths:
8+
- "package.json"
89

910
jobs:
1011
publish-dry-run:
11-
if: >
12-
github.event_name == 'workflow_dispatch' ||
13-
(github.event.pull_request.merged == true &&
14-
contains(github.event.pull_request.labels.*.name, 'ci-release'))
12+
if: "${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.head_commit.message, 'chore: release v') }}"
1513
runs-on: ubuntu-latest
1614
environment: general
1715

1816
steps:
1917
- uses: actions/checkout@v4
2018

19+
- name: Validate release commit
20+
if: github.event_name == 'push'
21+
run: |
22+
COMMIT_MSG="${{ github.event.head_commit.message }}"
23+
# Extract version from commit message and validate semver format
24+
if [[ "$COMMIT_MSG" =~ ^chore:\ release\ v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
25+
echo "Valid release commit: ${BASH_REMATCH[1]}"
26+
else
27+
echo "Commit message does not match expected pattern: chore: release vX.Y.Z"
28+
exit 1
29+
fi
30+
2131
- name: Use Node.js 22
2232
uses: actions/setup-node@v4
2333
with:

0 commit comments

Comments
 (0)