Skip to content

Commit

Permalink
Merge pull request #160 from VINAYAK777CODER/feat/pr-title-checker
Browse files Browse the repository at this point in the history
Feat: Add GitHub Actions workflow to validate PR titles
  • Loading branch information
1Shubham7 authored Oct 7, 2024
2 parents bc73322 + 2d23964 commit 7817f23
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pr-title-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PR Title Checker

on:
pull_request:
types: [opened, edited, reopened, synchronize]

jobs:
title-validation:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Validate PR Title
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
echo "Checking PR Title: $PR_TITLE"
if [[ ! "$PR_TITLE" =~ ^(Feat|Fix|Chore|Docs):\ .+ ]]; then
echo "❌ Invalid PR Title: '$PR_TITLE'"
echo "PR titles must follow the format: 'Feat: Description', 'Fix: Description', 'Chore: Description', or 'Docs: Description'"
exit 1
else
echo "✅ PR Title is valid: '$PR_TITLE'"
fi

0 comments on commit 7817f23

Please sign in to comment.