Skip to content

Commit 614666c

Browse files
committed
Workaround commit title-length check workflow bug
Signed-off-by: Chris Evich <[email protected]>
1 parent 347e3ca commit 614666c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/pr.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,25 @@ jobs:
1616
with:
1717
token: ${{ secrets.GITHUB_TOKEN }}
1818

19+
# Workaround limitation/bug in commit-message-checker-with-regex (action below) where
20+
# it breaks if there are "too many" commits in the PR.
21+
# Ref: https://github.com/tim-actions/commit-message-checker-with-regex/issues/7
22+
23+
- name: Reduce commit data
24+
run: >
25+
echo '${{ steps.get-pr-commits.outputs.commits }}' | \
26+
jq --monochrome-output --compact-output '[.[] | {"sha": .sha, "commit":{ "message": .commit.message }}]' \
27+
> filtered-commits.json
28+
29+
- name: Load filtered commit data into output
30+
id: 'get-pr-commit-messages'
31+
run: >
32+
echo "commit-messages=$(cat filtered-commits.json)" >> $GITHUB_OUTPUT
33+
1934
- if: contains(github.head_ref, 'renovate/') != true
2035
name: check subject line length
2136
uses: tim-actions/commit-message-checker-with-regex@094fc16ff83d04e2ec73edb5eaf6aa267db33791 # v0.3.2
2237
with:
23-
commits: ${{ steps.get-pr-commits.outputs.commits }}
38+
commits: ${{ steps.get-pr-commit-messages.outputs.commit-messages }}
2439
pattern: '^.{0,72}(\n.*)*$'
2540
error: 'Subject too long (max 72)'

0 commit comments

Comments
 (0)