-
-
Notifications
You must be signed in to change notification settings - Fork 454
84 lines (78 loc) · 1.88 KB
/
pr.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Check PR
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
pr:
if: github.repository == 'oxc-project/oxc'
name: Label and Check PR Title
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: actions/labeler@v5
- name: Validate PR title
id: pr-title
uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
requireScope: true
disallowScopes: |
build
chore
ci
release
revert
types: |
build
chore
ci
docs
feat
fix
perf
refactor
release
revert
style
test
- name: Get category label from PR title
id: get-category
env:
PR_TYPE: ${{ steps.pr-title.outputs.type }}
run: |
case "$PR_TYPE" in
"feat")
CATEGORY="C-enhancement"
;;
"fix")
CATEGORY="C-bug"
;;
"test")
CATEGORY="C-test"
;;
"refactor" | "chore" | "style")
CATEGORY="C-cleanup"
;;
"docs")
CATEGORY="C-docs"
;;
"perf")
CATEGORY="C-performance"
;;
*)
CATEGORY=""
;;
esac
echo "CATEGORY=$CATEGORY" >> $GITHUB_OUTPUT
- name: Add category label
uses: actions-ecosystem/action-add-labels@v1
if: ${{ steps.get-category.outputs.CATEGORY != '' }}
with:
labels: ${{ steps.get-category.outputs.CATEGORY }}