-
-
Notifications
You must be signed in to change notification settings - Fork 19
52 lines (49 loc) · 1.59 KB
/
git.yml
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
name: Git
on:
pull_request_target:
branches: [ master ]
jobs:
commit-messages:
name: Check commit messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Get PR URL
uses: Dovyski/payload-info-action@master
id: issue_url
with:
filter_pull_request: '.pull_request._links.issue.href'
- name: Check
env:
TYPES: ft|fix|docs|chore|test
run: |
! git log --oneline -E --invert-grep --grep="^($TYPES)(\([^)]\))?:" --pretty=format:"::error title=Invalid commit message::%h %s" origin/$GITHUB_BASE_REF... | grep "."
- name: Unlabel correct PR
if: ${{ success() }}
run: |
curl -X DELETE \
--header 'authorization: Bearer ${{ github.token }}' \
--header 'content-type: application/json' \
${{ steps.issue_url.outputs.value }}/labels/invalid/commit-messages
- name: Label PR with invalid commit messages
if: ${{ failure() }}
run: |
curl -X POST \
--header 'authorization: Bearer ${{ github.token }}' \
--header 'content-type: application/json' \
--data '["invalid/commit-messages"]' \
${{ steps.issue_url.outputs.value }}/labels
labeler:
name: Label PRs depending on changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/labeler@v3
with:
repo-token: "${{ github.token }}"