From 7c8c162375cfaca50de685bed587390be7047e6e Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Fri, 29 Jul 2022 22:20:02 +0100 Subject: [PATCH] Adds action to prevent un-named PRs --- .github/workflows/lint-pr-title.yml | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/lint-pr-title.yml diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml new file mode 100644 index 0000000..a1b6a75 --- /dev/null +++ b/.github/workflows/lint-pr-title.yml @@ -0,0 +1,30 @@ +# Checks that PR title conform to contributing standards (or at least !== Update README.md) +name: ⛳ Lint PR Title +on: + pull_request: + types: [opened, edited, synchronize, reopened] +jobs: + check-title: + runs-on: ubuntu-latest + steps: + - name: Check title prefix + uses: deepakputhraya/action-pr-title@v1.0.2 + with: + allowed_prefixes: 'Adds,Add,Removes,Remove,Updates,Update,Fixes,Fix,Amends,[AUTO]' # title should start with the given prefix + disallowed_prefixes: 'Update README.md' # title should not start with the given prefix + prefix_case_sensitive: false # title prefix are case insensitive + min_length: 18 # Min length of the title + max_length: 60 # Max length of the title + github_token: ${{ secrets.BOT_GITHUB_TOKEN || github.token }} + - name: Check title regex + uses: morrisoncole/pr-lint-action@v1.6.1 + with: + title-regex: "^(?!.*Update README.md).*" + on-failed-regex-fail-action: true + on-failed-regex-request-changes: true + on-failed-regex-create-review: true + on-failed-regex-comment: | + It looks like your title isn't very descriptive... + Please check the [contributing docs](https://github.com/Lissy93/awesome-privacy/blob/main/.github/CONTRIBUTING.md) before submitting a pull request. + on-succeeded-regex-dismiss-review-comment: "" + repo-token: "${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}"