From 779d360a8b0a2f13fbcdeb8d26d06158c670ed2a Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 24 Jul 2024 15:55:11 +0200 Subject: [PATCH] chore: lint pr titles --- .github/workflows/pr-title-linter.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/pr-title-linter.yml diff --git a/.github/workflows/pr-title-linter.yml b/.github/workflows/pr-title-linter.yml new file mode 100644 index 00000000..940b58eb --- /dev/null +++ b/.github/workflows/pr-title-linter.yml @@ -0,0 +1,26 @@ +name: PR Title Linter +on: + pull_request: + types: [opened, edited, reopened, unlocked] + +permissions: read-all + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + - name: Install commitlint + run: | + npm install @commitlint/config-conventional + npm install commitlint@latest + echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js + - name: "Lint: Pull request title" + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: echo $PR_TITLE | npx commitlint + + - name: "Warning: Pull request title must match patterns defined in CONTRIBUTING.md in section Commit Message Guidelines!" + if: ${{ failure() }} + run: echo "Pull request title must match patterns defined in CONTRIBUTING.md in section Commit Message Guidelines!"