CMP-2870, CMP-2869, CMP-2870, CMP-2872, CMP-2868: Compliance SDK Compliance Operator Implementation #1364
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" | |
| on: | |
| pull_request_target: | |
| types: [opened, edited, synchronize] | |
| jobs: | |
| check-title: | |
| runs-on: ubuntu-latest | |
| env: | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| steps: | |
| - name: Check if the PR title is well dressed | |
| if: >- | |
| github.event.pull_request.user.login != 'renovate[bot]' && | |
| github.event.pull_request.user.login != 'red-hat-konflux[bot]' | |
| env: | |
| JIRA: '([A-Z]+-[0-9]+, ?)*[A-Z]+-[0-9]+' | |
| TEXT: ': .+' | |
| run: | | |
| # Either conventional or JIRA-nnn prefix followed by ': ' and random text: | |
| REGEX="($JIRA)($TEXT)" | |
| test_regex() { echo -nE "$1" | grep --perl-regexp --line-regexp "$REGEX" ; } | |
| echo "Examples:" | |
| test_regex 'CMP-123: text' | |
| test_regex 'CMP-123, OCPBUGS-12345: text' | |
| if ! test_regex "$PR_TITLE" | |
| then | |
| echo "::error::Please update the PR title so that it follows the convention." | |
| exit 1 | |
| fi |