Skip to content

Commit

Permalink
WM-1963: Validate PRs begin with Jira tags (#7127)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjllanwarne committed May 15, 2023
1 parent 62509af commit 3db13d4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/validate_pr_name.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# A github action to validate the name of a pull request contains a Jira tag:

name: Validate PR name

on:
pull_request:
types: [opened, edited, synchronize]

jobs:
validate_pr_name:
runs-on: ubuntu-latest
steps:
- name: Validate PR title
id: validate
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const title = context.payload.pull_request.title;
const regex = /[A-Z][A-Z]+-\d+/;
if (!regex.test(title)) {
core.setFailed("PR title must contain a Jira tag");
}

0 comments on commit 3db13d4

Please sign in to comment.