Skip to content

Commit

Permalink
check requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahCx committed Sep 18, 2024
1 parent 2b61c4b commit a0ba858
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PR Linter

on:
pull_request:
types: [opened, edited]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check PR Title and Branch
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
PR_BRANCH="${{ github.head_ref }}"
if ! [[ "$PR_TITLE" =~ ^[A-Z][a-zA-Z0-9]* ]]; then
echo "::error::PR title must be in CamelCase. Please update the title."
exit 1
fi
if ! [[ "$PR_TITLE" =~ \(AST-[0-9]+\)$ ]]; then
echo "::error::PR title must contain a Jira ticket ID at the end in the format '(AST-XXXX)'."
exit 1
fi
if ! [[ "$PR_BRANCH" =~ ^(bug|feature)/ ]]; then
echo "::error::Branch name must start with 'bug/' or 'feature/'."
exit 1
fi
shell: bash

0 comments on commit a0ba858

Please sign in to comment.