diff --git a/.github/workflows/check_pr_title.yml b/.github/workflows/check_pr_title.yml new file mode 100644 index 0000000000..1c15d3f888 --- /dev/null +++ b/.github/workflows/check_pr_title.yml @@ -0,0 +1,25 @@ +name: Check PR Title for well-formed Jira issue + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +jobs: + check_title: + runs-on: ubuntu-latest + steps: + - name: Check PR Title for JIRA Key + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + #!/bin/bash + + jira_regex="ADFA-[0-9]+" + echo "<$jira_regex> <$PR_TITLE>" + + if grep -q "$jira_regex" <<< "$PR_TITLE"; then + echo "PR title '$PR_TITLE' contains a valid JIRA issue key." + else + echo "Error: PR title '$PR_TITLE' does not contain a valid JIRA issue key. Please ensure your title includes a key in the format ADFA-XXXX." + exit 1 + fi