-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGit_Check_Commit_Message
More file actions
68 lines (60 loc) · 2.41 KB
/
Git_Check_Commit_Message
File metadata and controls
68 lines (60 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
### Check Commit Message
> 참고]
> https://github.com/marketplace/actions/commit-message-checker-for-pull-request
> https://github.com/GsActions/commit-message-checker/blob/main/.github/workflows/test.yml
> https://github.com/marketplace/actions/gs-commit-message-checker
```
name: Check Commit Message
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
pull_request_target:
types:
- opened
- edited
- reopened
- synchronize
# push:
# branches:
# - master
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check Commit Type
uses: gsactions/commit-message-checker@v1
with:
pattern: '(Feat|feat|Fix|fix|Design|design|Style|style|Refactor|refactor|Comment|comment|Docs|docs|Test|test|Chore|chore|Rename|rename|Remove|remove) .+$'
flags: 'gm'
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
error: 'Your first line has to contain a commit type like "Fix".'
# - name: Check for Issue number
# uses: gsactions/commit-message-checker@v1
# with:
# pattern: '(issue) \#([1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])+$'
# checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
# accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
# error: 'You need at least one "issue #<issue number>" line.'
run-if-fail:
if: ${{ always() && (needs.check.result=='failure') }}
needs: [check]
runs-on: ubuntu-latest
env:
PR_NUMBER: ${{ github.event.number }}
steps:
- uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: ${{ env.PR_NUMBER }},
owner: context.repo.owner,
repo: context.repo.repo,
body: '요청해 주신 PR이 [하모나이즈 프로젝트의 커밋 컨벤션](https://github.com/hamonikr/hamonize/blob/master/.gitmessage.txt)을 위반합니다. \n커밋 메시지에 커밋 타입을 포함해 주세요. '
})
```