From 6869b47fc3a01233a7f8557bdc6637d7e9df1309 Mon Sep 17 00:00:00 2001 From: Daniel Farrell Date: Wed, 30 Jun 2021 11:26:39 -0500 Subject: [PATCH] Add linter to check no "Apply suggestions" commits (#154) Add a linting job to verify that no commit message in a PR contains the case insensitive string "Apply suggestions from code review". Commits with exactly this title are generated by GitHub automatically when a batch of proposed changes from code review are accepted from the GitHub UI. A number of such commits have made it into various Submariner/* repos. Commits addressing code review feedback should typically be squashed into the commits under review, or made into well-commented discrete commits. Signed-off-by: Daniel Farrell --- .github/workflows/linting.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 4b5a1a8..4172588 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -5,6 +5,24 @@ on: pull_request: jobs: + apply-suggestions-commits: + name: 'No "Apply suggestions from code review" Commits' + runs-on: ubuntu-latest + steps: + - name: Get PR commits + id: 'get-pr-commits' + uses: tim-actions/get-pr-commits@v1.1.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: 'Verify no "Apply suggestions from code review" commits' + uses: tim-actions/commit-message-checker-with-regex@v0.3.1 + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} + pattern: '^(?!.*(apply suggestions from code review))' + flags: 'i' + error: 'Commits addressing code review feedback should typically be squashed into the commits under review' + chart-testing: name: Helm Chart Linting runs-on: ubuntu-latest