Skip to content

Commit

Permalink
commit validation CI: work with regular push as well as pr.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Dec 27, 2023
1 parent b9b8343 commit 0ba8af9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/commit-validation.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: commit-validation
on: [ pull_request ]
on: [ push, pull_request ]

permissions:
contents: read
Expand All @@ -16,7 +16,12 @@ jobs:
result-encoding: json
script: |
var longlines = 0;
const commits = ${{ toJSON(github.event.pull_request.commits) }}
const commits = [];
if (github.event.pull_request) {
commits = ${{ toJSON(github.event.pull_request.commits) }};
} else {
commits = ${{ toJSON(github.event.commits) }};
}
for (const commit of commits) {
for (const line of commit.message.split('\n')) {
if (line.length > 78) {
Expand Down

0 comments on commit 0ba8af9

Please sign in to comment.