Skip to content

Commit

Permalink
chore: regular and git actions yml
Browse files Browse the repository at this point in the history
  • Loading branch information
junha-ahn committed Jul 7, 2023
1 parent 7519d9a commit 724b4ac
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/commit-regular.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(feat|fix|refactor|style|docs|test|chore):.{1,50}(\n.{1,72})?$
30 changes: 30 additions & 0 deletions .github/workflows/commit-msg-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Commit Message Check

on: [push]

jobs:
commit_message_check:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Read Commit Regular Expression
id: read_commit_regex
run: |
commit_msg_regex=$(cat ./.github/commit-regular.txt)
echo "Commit Regular Expression: $commit_msg_regex"
echo "::set-output name=commit_regex::$commit_msg_regex"
- name: Validate Commit Message
run: |
commit_msg=$(git log --format=%B -n 1 ${{ github.sha }})
echo "Commit Message: $commit_msg"
commit_regex="${{ steps.read_commit_regex.outputs.commit_regex }}"
if [[ ! "$commit_msg" =~ $commit_regex ]]; then
echo "Invalid commit message format."
exit 1
else
echo "Commit message is valid."
fi

0 comments on commit 724b4ac

Please sign in to comment.