TECH_DEBT: Add QA2 support and fix full commit hash resolution in get_deployed_commit.py #7547
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
| # From: https://levelup.gitconnected.com/enforcing-jira-ticket-formatting-in-github-pr-titles-and-commit-messages-78d9755568df | |
| name: "PR Title Check" | |
| on: | |
| pull_request: | |
| branches: | |
| - dev | |
| - main | |
| - 'release/**' | |
| - 'hotfix/**' | |
| types: [opened, edited, synchronize] | |
| merge_group: | |
| branches: | |
| - dev | |
| jobs: | |
| check-title: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check PR title | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const payload = context.payload | |
| let prTitle | |
| if (payload.pull_request) { | |
| prTitle = payload.pull_request.title | |
| } else if (payload.merge_group && payload.merge_group.pull_requests?.length) { | |
| prTitle = payload.merge_group.pull_requests[0].title | |
| } else { | |
| core.setFailed('Cannot determine PR title for validation.') | |
| } | |
| const prTitleExpectedPattern = /(^LNK-\d+:\s)|(^LEGLINK-\d+:\s)|(^LEGPROG-\d+:\s)|(^TECH_DEBT:\s)|(^DOCS:\s)|(^SNYK:\s)|(^Dops-)|(^Bump\s)/g | |
| const prTitleMismatchError = 'Invalid PR title "' + prTitle + '"! Must begin with LNK-nnnn:<space> or LEGLINK-nnnn:<space> or LEGPROG-nnnn:<space> or TECH_DEBT:<space> or DOCS:<space> or SNYK:<space> or Dops- or Bump<space>, e.g. LNK-1234: My PR title, or TECH_DEBT or DOCS or SNYK or Dops- or Bump: My PR title or DOCS: My PR title or [Snyk] My PR title' | |
| if (!prTitleExpectedPattern.test(prTitle)) { | |
| // Fail the workflow | |
| console.log(prTitleMismatchError) | |
| core.setFailed(prTitleMismatchError) | |
| } else { | |
| console.log('PR title format is correct.') | |
| } |