diff options
| author | John MacFarlane <[email protected]> | 2023-12-19 15:34:45 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-12-19 15:51:28 -0800 |
| commit | 6b6da8b15460d4aac5e732a1df9bebef503d3931 (patch) | |
| tree | 57354e4538acbb0d7dc56d4b1b35a6a1c3ec7b10 /.github | |
| parent | 987599355917ea928beb9abde56d7c4f0f5444b9 (diff) | |
Fix commit validation CI.
This CI action has been broken for a long time, giving us false
negatives.
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/commit-validation.yml | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/.github/workflows/commit-validation.yml b/.github/workflows/commit-validation.yml index bd731c2cc..547b374fa 100644 --- a/.github/workflows/commit-validation.yml +++ b/.github/workflows/commit-validation.yml @@ -15,23 +15,25 @@ jobs: with: result-encoding: json script: | - var longlines = []; + var longlines = 0; const commits = ${{ toJSON(github.event.commits) }} for (const commit of commits) { - if (/^.{79}/.test(commit.message)) { - longlines.push(commit.sha) + for (const line of commit.message.split('\n')) { + if (line.length > 78) { + longlines += 1; + console.log("Overlong line:\n" + line); + } } } return longlines - name: Get result run: | - result="${{steps.check-commit-msg-length.outputs.result}}" - if [[ $result = "" ]]; then + result=${{steps.check-commit-msg-length.outputs.result}} + if [[ $result -eq 0 ]]; then echo "Ok" exit 0 else - echo "Commit messages for these commits contain lines > 78 characters:" - echo $result + echo "Commit messages contain $result lines longer than 78 characters." + echo "See under 'Check commit message length' for a list of the lines." exit 1 fi - |
