Skip to content

Commit

Permalink
Set a maximum number of diff output lines in email workflow (chapel-l…
Browse files Browse the repository at this point in the history
…ang#24417)

Modify the Github Actions email-on-merge workflow to cut off the git
diff output at 1000 lines, including a note if it was truncated.

Job
https://github.com/chapel-lang/chapel/actions/runs/7907690909/job/21585278415?pr=24417
shows this working with a temporary patch to let it do a dry run on an
unmerged PR. Click into the step "Get merge log" to see diff output with
max 2 allowed lines.

Resolves Cray/chapel-private#5915.

[reviewed by @jhh67 , thanks!]

Testing:
- [x] test job run described above
  • Loading branch information
riftEmber authored Feb 20, 2024
2 parents 49b5978 + 098ec41 commit e09ddc1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/email.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ jobs:
echo 'EOF' >> $GITHUB_ENV
diff=$(git --no-pager diff --merge-base --name-status --diff-filter=ACDMRT ${{github.event.pull_request.base.sha}} ${{github.event.pull_request.head.sha}})
# Cut off long diff output after some number of lines
diff_max_lines=1000
diff=$(echo "$diff" | awk "NR <= $diff_max_lines; NR > $diff_max_lines { print \"(diff output truncated at $diff_max_lines lines)\"; exit }")
echo "$diff"
echo 'DIFF<<EOF' >> $GITHUB_ENV
echo "$diff" >> $GITHUB_ENV
Expand Down

0 comments on commit e09ddc1

Please sign in to comment.