From 2b369ce6ded532ad501331bbf004fc34136b092a Mon Sep 17 00:00:00 2001 From: "bjz@Brads-MacBook-Pro.local" <> Date: Thu, 24 Nov 2022 10:42:37 +1030 Subject: [PATCH] chore: add action to enforce semantic-pr titles I've seen a few PRs recently that haven't had the correct titles. I accidentally merged one that was missing the colon! This PR adds an action that will validate the PR titles match the semantic commit spec using this action: https://github.com/amannn/action-semantic-pull-request --- .github/workflows/semantic-pr-titles.yml | 52 ++++++++++++++++++++++++ CONTRIBUTING.md | 2 + 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/semantic-pr-titles.yml diff --git a/.github/workflows/semantic-pr-titles.yml b/.github/workflows/semantic-pr-titles.yml new file mode 100644 index 000000000000..24b6fb7c7ab9 --- /dev/null +++ b/.github/workflows/semantic-pr-titles.yml @@ -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] " diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3c08116cdc9c..aaf07b243ee4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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: + + - `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