feat(ci): add check for PR description #8098
This file contains 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: 'PR checks' | |
on: | |
pull_request: | |
types: | |
- opened | |
- edited | |
- reopened | |
- synchronize | |
- labeled | |
jobs: | |
check-pr-title: | |
name: 'check-pr-title:required' | |
runs-on: ubuntu-24.04 | |
env: | |
TITLE: ${{ github.event.pull_request.title }} | |
steps: | |
- name: 'Check PR Title' | |
run: | | |
if [[ "$TITLE" =~ ^(feat|fix|chore|build|ci|docs|style|refactor|perf|test)(\([-a-zA-Z0-9,]+\))\!?\: ]]; then | |
echo "PR Title passes" | |
else | |
echo "PR Title does not match conventions:" | |
echo " verb(scope): description" | |
echo "or for a breaking change:" | |
echo " verb(scope)!: description" | |
echo "For scope, please use the affected canister name(s) or 'ci' for infrastructure changes." | |
exit 1 | |
fi | |
check-pr-description: | |
name: 'check-pr-description:required' | |
runs-on: ubuntu-24.04 | |
env: | |
DESCRIPTION: ${{ github.event.pull_request.body }} | |
steps: | |
- name: 'Check PR Description for Jira/Atlassian Links' | |
run: | | |
if [[ "$DESCRIPTION" =~ https:\/\/[a-zA-Z0-9]*\.(atlassian|jira)\.[a-z]{2,3} ]]; then | |
echo "PR Description contains a link to Jira or Atlassian, which is not allowed." | |
exit 1 | |
else | |
echo "PR Description passes" | |
fi |