Skip to content

Commit 6ebbd0d

Browse files
aduh95targos
authored andcommitted
tools: fix commit-lint GH Actions CI
PR-URL: #40845 Reviewed-By: James M Snell <[email protected]>
1 parent 6e9b665 commit 6ebbd0d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/commit-lint.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@ 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: |
15+
echo "::set-output name=plusOne::$((${{ github.event.pull_request.commits }} + 1))"
16+
echo "::set-output name=minusOne::$((${{ github.event.pull_request.commits }} - 1))"
1217
- uses: actions/checkout@v2
1318
with:
14-
fetch-depth: 2
19+
fetch-depth: ${{ steps.nb-of-commits.outputs.plusOne }}
20+
- run: git reset HEAD^2
1521
- name: Install Node.js
1622
uses: actions/setup-node@v2
1723
with:
1824
node-version: ${{ env.NODE_VERSION }}
1925
- name: Validate commit message
2026
run: |
2127
echo "::add-matcher::.github/workflows/commit-lint-problem-matcher.json"
22-
git rev-parse HEAD^ | xargs npx -q core-validate-commit --no-validate-metadata --tap
28+
git rev-parse HEAD~${{ steps.nb-of-commits.outputs.minusOne }} | xargs npx -q core-validate-commit --no-validate-metadata --tap

0 commit comments

Comments
 (0)