ADFA-781 enforce well formatted PR titles that refer to jira tickets #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 [[ "$PR_TITLE" =~ "$jira_regex" ]]; 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 |