Skip to content

chore: add action to enforce semantic-pr titles #6075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/semantic-pr-titles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Semantic PR Titles

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

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# keep this synchronized with the /CONTRIBUTING.md
types: |
docs
feat
fix
test
chore
# deps is used by renovate for its PRs
scopes: |
deps
ast-spec
eslint-plugin
eslint-plugin-internal
eslint-plugin-tslint
experimental-utils
parser
scope-manager
type-utils
types
typescript-estree
utils
visitor-keys
website
# we allow "cross package" PRs with no scope
requireScope: false
# ensure that the subject is lower-case first
# also allows "[rule-name] " prefix for eslint-plugin rule PRs
# https://regexr.com/733ed
subjectPattern: ^(\[[a-z\-]+\] )?[a-z].+[^\.]$
subjectPatternError: |
The "subject" must start with a lower-case letter and must not
end with a full-stop.
For PRs that add or change ESLint-plugin rules, you should begin
the title with "[rule-name] "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice if this was enforceable too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it's just hard cos if you're making non-rule-specific changes you don't want to add it - so it's hard to properly enforce.

2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Within the body of your PR, make sure you reference the issue that you have work

Must be one of the following:

<!-- Keep this synchronized with /.github/workflows/semantic-pr-titles.yml -->

- `docs` - if you only change documentation, and not shipped code
- `feat` - for any new functionality additions
- `fix` - for any bug fixes that don't add new functionality
Expand Down