From 22838f6fbdd35fde3ed4d57d979395c57f2968c2 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Tue, 17 Mar 2020 21:02:55 -0400 Subject: [PATCH] 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 --- .github/workflows/CI.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 356a9f990e4290..7a5b369eb5c587 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -49,6 +49,23 @@ jobs: node-version: 10.x - name: Lint addon docs run: NODE=$(which node) make lint-addon-docs + lint-commit-message: + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Lints message of the first commit in this pull request + continue-on-error: true + run: bash -x tools/lint-pr-commit-message.sh ${{ github.event.number }} || echo ::set-env name=needs_fixup::true + - name: Label on commit message lint failure + if: env.needs_fixup == 'true' + uses: actions/github@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: label "needs commit message fix" lint-cpp: runs-on: ubuntu-latest steps: