Skip to content
This repository was archived by the owner on Apr 14, 2025. It is now read-only.

Commit b20cc0d

Browse files
committed
chore: 🔨 enhance GitHub Actions workflow to check commit messages for release triggers
1 parent 08e7ded commit b20cc0d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

‎.github/workflows/release.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,38 @@ on:
44
push:
55
branches:
66
- main
7+
paths-ignore:
8+
- '**.md'
9+
- '.gitignore'
10+
- '.editorconfig'
11+
- 'LICENSE'
12+
- '.github/**'
13+
- '!.github/workflows/**'
714

815
jobs:
16+
check-commit:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
should_release: ${{ steps.check.outputs.should_release }}
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Check commit message
27+
id: check
28+
run: |
29+
COMMIT_MSG=$(git log -1 --pretty=format:%s)
30+
if [[ $COMMIT_MSG =~ ^(feat|fix): ]]; then
31+
echo "should_release=true" >> $GITHUB_OUTPUT
32+
else
33+
echo "should_release=false" >> $GITHUB_OUTPUT
34+
fi
35+
936
build-and-release:
37+
needs: check-commit
38+
if: needs.check-commit.outputs.should_release == 'true'
1039
runs-on: ubuntu-latest
1140
permissions:
1241
contents: write

0 commit comments

Comments
 (0)