Skip to content

Commit 3fd4950

Browse files
authored
build: update semantic pr title workflow (#2113)
Signed-off-by: Adam Setch <[email protected]>
1 parent 600e352 commit 3fd4950

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

.github/workflows/triage.yml

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ name: Triage PR
22

33
on:
44
pull_request_target:
5+
branches:
6+
- main
57
types:
68
- opened
9+
- reopened
710
- edited
811
- synchronize
912
- ready_for_review
10-
branches:
11-
- main
1213

1314
permissions:
1415
contents: read # the config file
@@ -17,31 +18,15 @@ permissions:
1718
checks: write # to generate status
1819

1920
jobs:
20-
pr-lint:
21+
pr-title:
2122
name: Validate PR title
2223
runs-on: ubuntu-latest
2324
steps:
24-
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
25-
with:
26-
script: |
27-
const title = context.payload.pull_request.title;
28-
const regex = /^(?<type>build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|deps)(?<scope>\([\w\-\/]+\)?((?=:\s)|(?=!:\s)))?(?<breaking>!)?(?<subject>:\s.*)?/gm;
29-
const match = regex.exec(title);
30-
31-
if (!match) {
32-
core.setFailed('Invalid PR title');
33-
}
34-
if (!match.groups.type && !match.groups.subject) {
35-
core.setFailed('Missing type and subject in PR title');
36-
}
37-
if (!match.groups.type) {
38-
core.setFailed('Missing type in PR title');
39-
}
40-
if (!match.groups.subject) {
41-
core.setFailed('Missing subject in PR title');
42-
}
43-
44-
labeler:
25+
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
29+
pr-labeler:
4530
name: Auto-label PR
4631
runs-on: ubuntu-latest
4732
steps:

0 commit comments

Comments
 (0)