We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c01d223 commit 9454b4aCopy full SHA for 9454b4a
.github/workflows/commitlint.yaml
@@ -24,6 +24,16 @@ jobs:
24
25
- if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags')
26
name: commitlint (push)
27
- run: commitlint --from ${{ github.event.before }}
28
# use .before instead of HEAD~1 so that pushes with multiple commits are completely covered as well
29
- # --from is not inclusive, so HEAD~1 will only analyze HEAD
+ # --from is not inclusive, so HEAD~1 will only analyze HEAD
+ # BUT:
30
+ # check if commit exists first (e.g. it doesn't if it was force pushed)
31
+ # or fall back to HEAD~1
32
+ run: |
33
+ git cat-file -t ${{ github.event.before }} > /dev/null
34
+ if [[ $? -eq "0" ]]; then
35
+ commitlint --from ${{ github.event.before }}
36
+ else
37
+ commitlint --from HEAD~1
38
+ fi
39
+
0 commit comments