File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -107,8 +107,6 @@ jobs:
107
107
steps :
108
108
- name : Checkout source
109
109
uses : actions/checkout@v3
110
- with :
111
- ref : ${{ github.event.pull_request.head.sha }}
112
110
113
111
- name : Setup Python
114
112
uses : actions/setup-python@v3
@@ -119,11 +117,25 @@ jobs:
119
117
- name : Run Pre-commit
120
118
run : pre-commit run --all-files
121
119
122
- - name : Run Commitlint
123
- run : |
124
- COMMIT_MSG=$(git log -1 --pretty=%B)
125
- echo "$COMMIT_MSG" > .git/COMMIT_EDITMSG
126
- pre-commit run commitlint --hook-stage commit-msg --commit-msg-file .git/COMMIT_EDITMSG
120
+ # Using vanilla commitlint instead of running via pre-commit because pre-commit
121
+ # hooks are meant to run on the commit-msg hook which will only run at the time of commit creation.
122
+ # Also it will only validate the current commit message, not the entire commit history.
123
+ commit-msg-check :
124
+ runs-on : ubuntu-latest
125
+ steps :
126
+ - name : Checkout source
127
+ uses : actions/checkout@v4
128
+ with :
129
+ fetch-depth : 0 # Fetch all the history of PR commits
130
+
131
+ - name : Setup node
132
+ uses : actions/setup-node@v4
133
+
134
+ - name : Install commitlint
135
+ run : npm install @commitlint/cli @commitlint/config-conventional
136
+
137
+ - name : Validate PR commits
138
+ run : npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
127
139
128
140
build-images :
129
141
runs-on : ubuntu-latest
You can’t perform that action at this time.
0 commit comments