We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 17303f4 commit 05bb4c0Copy full SHA for 05bb4c0
1 file changed
.github/pr-validator.yml
@@ -0,0 +1,24 @@
1
+name: "PR Title Check"
2
+on:
3
+ pull_request:
4
+ types: [opened, edited, synchronize]
5
+jobs:
6
+ check-title:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - name: Check PR title
10
+ uses: actions/github-script@v4
11
+ with:
12
+ github-token: ${{ secrets.GITHUB_TOKEN }}
13
+ script: |
14
+ const payload = context.payload
15
+ const prTitle = payload.pull_request.title
16
+ // The pattern for JIRA ticket format
17
+ const jiraPattern = /([A-Z]+-\d+)|(breakglass)/gi;
18
+ if (!jiraPattern.test(prTitle)) {
19
+ console.log('The PR title does not match JIRA ticket format!')
20
+ // Fails the workflow
21
+ core.setFailed('PR title does not match JIRA ticket format!')
22
+ } else {
23
+ console.log('PR title format is correct.')
24
+ }
0 commit comments