kuma
1name: "Lint PRs"
2on:
3pull_request:
4types:
5- edited
6- opened
7- reopened
8- synchronized
9permissions:
10contents: read
11jobs:
12# This job checks the PR title using
13# https://github.com/conventional-changelog/commitlint
14# for the conventional commit format at
15# https://www.conventionalcommits.org/en/v1.0.0/
16# See also /.github/commitlint.config.js for more details
17# We only need to check the PR title because it will end up being the
18# (default) commit title when doing squash merges with Github.
19# See
20# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#merge-message-for-a-squash-merge
21# for more info. We have "Default to PR title for squash merge commits" enabled.
22commit-lint:
23timeout-minutes: 10
24name: "Check PR title"
25runs-on: ubuntu-latest
26steps:
27- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
28with:
29fetch-depth: 0
30- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
31- run: npm install -g @commitlint/cli @commitlint/config-conventional
32- name: "Check PR title"
33# Inject as env variable to escape properly
34env:
35TITLE: ${{ github.event.pull_request.title }}
36run: |
37commitlint --config .github/commitlint.config.js --edit=<(echo "${TITLE}")
38