[DEVOPS-3735] ci: github actions for PR static check #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" | |
| on: | |
| pull_request: | |
| types: [opened, edited] | |
| paths-ignore: | |
| - README.md | |
| - 'docs/**' | |
| jobs: | |
| gh-pr-title: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check PR title | |
| run: | | |
| TITLE_RE='^(\[(BACKPORT )?(\d+(\.\d+)+)\])?' | |
| TITLE_RE+='\[((#\d+(,#\d+)*)|([A-Z]+-\d+(,[A-Z]+-\d+)*))\]' | |
| TITLE_RE+=' [\w-]+(,[\w-]+)*:' | |
| TITLE_RE+=' \S.{8,98}\S$' | |
| if [[ ! "${{ github.event.pull_request.title }}" =~ $TITLE_RE ]]; then | |
| echo "::error ::PR title must include issue ID, code area (no extra whitespace), and short description.) | |
| echo "::error :: [#12345,#12367] area: Cool feature xyz" | |
| echo "::error :: [BACKPORT branch][#12345] area1,area2: Must have fix" | |
| echo "::error ::Issue referenced must be a github issue or YB-internal Jira ID" | |
| echo "::error ::Short description must be less than 100 characters." | |
| exit 1 | |
| fi |