Skip to content

Commit

Permalink
chore: add pull request title validator (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamagalhaes authored Oct 14, 2024
1 parent 5c15020 commit 194bf0b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- ## Title Guidelines
A title always has a prefix and a subject.
### Prefix
Make sure the title is prefixed with one of the following:
| Prefix | When to use |
|--------|-------------|
| `feat:` | New feature |
| `fix:` | Bug fix |
| `docs:` | Documentation only changes |
| `style:` | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
| `refactor:` | Code changes that neither fixes a bug nor adds a feature |
| `perf:` | Code change that improves performance |
| `test:` | Adding missing or correcting existing tests |
| `chore:` | Changes to the build process or auxiliary tools and libraries such as documentation generation, ci, etc |
### Subject
Ensure the subject contains succinct description of the change.
* Use the imperative, present tense: "change", not "changed" nor "changes"
* Don’t capitalize first letter
* No dot (.) at the end
-->
28 changes: 28 additions & 0 deletions .github/workflows/pull-request-title-validator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Pull Request Title Validator"

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened

permissions:
pull-requests: read

jobs:
# Ensure PR title matches Angular Commit Guidelines
validate-pr-title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
with:
subjectPattern: ^(?![A-Z]).+(?<!\.)$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character and doesn't end with a period.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 194bf0b

Please sign in to comment.