From 52be015e9229c387708af662d438c8792bbfe0ab Mon Sep 17 00:00:00 2001 From: junjiequan Date: Wed, 31 Jul 2024 14:32:27 +0200 Subject: [PATCH] ci: add GitHub Action to enforce PR title format --- .github/pr-title-checker-config.json | 15 +++++++++++++ ...endabot.yaml => auto-merge-dependabot.yml} | 0 .../{build-release.yaml => build-release.yml} | 0 .github/workflows/pr-title-checker.yml | 22 +++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 .github/pr-title-checker-config.json rename .github/workflows/{auto-merge-dependabot.yaml => auto-merge-dependabot.yml} (100%) rename .github/workflows/{build-release.yaml => build-release.yml} (100%) create mode 100644 .github/workflows/pr-title-checker.yml diff --git a/.github/pr-title-checker-config.json b/.github/pr-title-checker-config.json new file mode 100644 index 000000000..893159467 --- /dev/null +++ b/.github/pr-title-checker-config.json @@ -0,0 +1,15 @@ +{ + "LABEL": { + "name": "" + }, + "CHECKS": { + "NOTE": "You can test the regex here: https://regex101.com/r/nDeps5/1", + "regexp": "(^(?build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|BREAKING CHANGE)(?\\([\\w\\s*-]+\\))?(?!?): (?([a-z]).+[^.|\\s])$)", + "regexpFlags": "gm" + }, + "MESSAGES": { + "success": "All OK", + "failure": "PR title not following the semantic-release guidelines. Please check https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines for more information.", + "notice": "" + } +} diff --git a/.github/workflows/auto-merge-dependabot.yaml b/.github/workflows/auto-merge-dependabot.yml similarity index 100% rename from .github/workflows/auto-merge-dependabot.yaml rename to .github/workflows/auto-merge-dependabot.yml diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yml similarity index 100% rename from .github/workflows/build-release.yaml rename to .github/workflows/build-release.yml diff --git a/.github/workflows/pr-title-checker.yml b/.github/workflows/pr-title-checker.yml new file mode 100644 index 000000000..07be7fd15 --- /dev/null +++ b/.github/workflows/pr-title-checker.yml @@ -0,0 +1,22 @@ +name: PR Title Checker + +on: + pull_request: + branches: + - master + types: + - opened + - edited + - synchronize + - labeled + - unlabeled + +jobs: + check-pr-title: + runs-on: ubuntu-latest + steps: + - uses: thehanimo/pr-title-checker@v1.4.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + pass_on_octokit_error: false + configuration_path: .github/pr-title-checker-config.json #(optional. defaults to .github/pr-title-checker-config.json)