Skip to content

Commit 727b34e

Browse files
aduh95targos
authored andcommitted
tools: only validate first commit message of a PR
PR-URL: #40740 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 10a842d commit 727b34e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

.github/workflows/commit-lint.yml

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Commit messages adheres to guidelines at https://goo.gl/p2fr5Q"
1+
name: "First commit message adheres to guidelines at https://goo.gl/p2fr5Q"
22

33
on: [pull_request]
44

@@ -9,17 +9,14 @@ jobs:
99
lint-commit-message:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Compute number of commits in the PR
13-
id: nb-of-commits
14-
run: echo "::set-output name=nb::$((${{ github.event.pull_request.commits }} + 1))"
1512
- uses: actions/checkout@v2
1613
with:
17-
fetch-depth: ${{ steps.nb-of-commits.outputs.nb }}
14+
fetch-depth: 2
1815
- name: Install Node.js
1916
uses: actions/setup-node@v2
2017
with:
2118
node-version: ${{ env.NODE_VERSION }}
22-
- name: Validate commit messages
19+
- name: Validate commit message
2320
run: |
2421
echo "::add-matcher::.github/workflows/commit-lint-problem-matcher.json"
25-
git log --oneline -${{ github.event.pull_request.commits }} HEAD^ | awk '{ if ($2 != "fixup!" && $2 != "squash!") { print $1 } }' | xargs npx -q core-validate-commit --no-validate-metadata --tap
22+
git rev-parse HEAD^ | xargs npx -q core-validate-commit --no-validate-metadata --tap

0 commit comments

Comments
 (0)