Skip to content

Commit

Permalink
feat: add PR Title Linter (#22)
Browse files Browse the repository at this point in the history
* add shellcheck

* edit shellcheck

* edit shellcheck

* add Git Guardian workflow

* Sync the master and dev branches (#16)

* edit shellcheck (#8)

* add shellcheck

* edit shellcheck

* edit shellcheck

* Update README.md (#9)

* Update README.md (#10)

* Update README.md (#11)

* Update README.md (#12)

* add Git Guardian workflow (#13)

* add shellcheck

* edit shellcheck

* edit shellcheck

* add Git Guardian workflow

* Update README.md (#14)

* Update README.md (#15)

* edit release badge

* add .gitignore file

* edit .awk file path

* bump version of GitGuardian scan

* bump version of action checkout

* add PR Title Linter
  • Loading branch information
meleksabit authored Nov 17, 2024
1 parent bd7c180 commit e9d70fd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pr-title-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PR Title Check

on:
pull_request:
types: [opened, edited]

jobs:
lint-pr-title:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check PR Title
uses: actions/[email protected]
with:
script: |
const title = context.payload.pull_request.title;
const regex = /^(feat|fix|chore|docs|style|refactor|perf|test): .+/;
if (!regex.test(title)) {
core.setFailed(`Invalid PR title: "${title}". Titles must match the pattern "type: description" (e.g., "feat: Add new feature").`);
} else {
console.log(`PR title "${title}" is valid.`);
}

0 comments on commit e9d70fd

Please sign in to comment.