-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (51 loc) · 1.89 KB
/
gh-pr-label-title.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
# Automatically apply labels to PR based on title (if written in semantic format)
name: Github PR Label Title
on:
pull_request:
# https://frontside.com/blog/2020-05-26-github-actions-pull_request/
types:
- opened
- edited
jobs:
label:
# Avoid re-label if title not changed or using custom label to prevent
# https://github.com/orgs/community/discussions/101695
if: |
${{ !contains(github.event.pull_request.labels.*.name , 'no-autolabel')}} &&
(event.type == 'opened' || event.changes.title.from)
runs-on: ubuntu-latest
steps:
# Checkout repo to access local templates (if updated)
- name: checkout
uses: actions/checkout@main
# Check if PR title matches conventional commit standard
# Not strictly enforced so allow continue on error
# https://github.com/marketplace/actions/semantic-pull-request
- name: Validate PR title
uses: amannn/action-semantic-pull-request@v5
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Assign labels based on conventional PR title
# https://github.com/marketplace/actions/conventional-release-labels
- name: Assign PR Name Labels
uses: bcoe/[email protected]
with:
# Labels assigned based on pr name prefix
type_labels: |
{
"breaking": "breaking",
"chore": "maintenance",
"docs": "documentation",
"feat": "feature",
"fix": "fix",
"refactor": "maintenance",
"Breaking": "breaking",
"Chore": "maintenance",
"Docs": "documentation",
"Feat": "feature",
"Fix": "fix",
"Refactor": "maintenance"
}
# Do not ignore any labels (default ignores chore:)
ignored_types: '[]'