Skip to content

Commit bba29c3

Browse files
committed
build: add commit message linting to workflow
Run linting on the commit message of the first commit in a pull request as part of our GitHub actions CI workflow. If linting fails the pull request will be labelled as requiring a fix to the commit message. The check itself will always pass so as to not concern first time contributors. Signed-off-by: Richard Lau <[email protected]>
1 parent 960df3f commit bba29c3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.github/workflows/CI.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ jobs:
4949
node-version: 10.x
5050
- name: Lint addon docs
5151
run: NODE=$(which node) make lint-addon-docs
52+
lint-commit-message:
53+
runs-on: ubuntu-latest
54+
if: github.event_name == 'pull_request'
55+
steps:
56+
- uses: actions/checkout@v2
57+
with:
58+
fetch-depth: 0
59+
- name: Lints message of the first commit in this pull request
60+
continue-on-error: true
61+
run: bash -x tools/lint-pr-commit-message.sh ${{ github.event.number }} || echo ::set-env name=needs_fixup::true
62+
- name: Label on commit message lint failure
63+
if: env.needs_fixup == 'true'
64+
uses: actions/[email protected]
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
with:
68+
args: label "needs commit message fix"
5269
lint-cpp:
5370
runs-on: ubuntu-latest
5471
steps:

0 commit comments

Comments
 (0)