From 0ba8af939c7bf95882ea8c2e877f20fd533202fc Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 26 Dec 2023 22:49:50 -0800 Subject: [PATCH] commit validation CI: work with regular push as well as pr. --- .github/workflows/commit-validation.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commit-validation.yml b/.github/workflows/commit-validation.yml index 45eb552146c6..a7ba07a737b4 100644 --- a/.github/workflows/commit-validation.yml +++ b/.github/workflows/commit-validation.yml @@ -1,5 +1,5 @@ name: commit-validation -on: [ pull_request ] +on: [ push, pull_request ] permissions: contents: read @@ -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) {