Repository navigation
ci: show the spec diff when the staleness check fails - #43912
Conversation
The failure reported only a line count, so an author had to regenerate locally to find out what changed. Render the diff to the job summary and keep the full copy in a collapsed log group.
|
Bito Automatic Review Skipped - Files Excluded |
|
The flagged issue is correct. When To resolve this, you can use Here is the corrected implementation for the affected block: echo '```diff'
git diff -- "$SPEC" > diff.tmp
head -300 diff.tmp
echo '```'
if [ "$(wc -l < diff.tmp)" -gt 300 ]; then
echo
echo '_Truncated at 300 lines; see the job log for the full diff._'
fi
rm diff.tmpI have checked the other comments on this PR, and there are no additional comments to address. Would you like me to perform any further actions? .github/workflows/check-openapi-spec-drift.yml |
Piping into `head` let it close the pipe once the diff exceeded the buffer, SIGPIPE-killing `git diff` under pipefail and aborting the step at exit 141 — so the summary lost its closing fence and truncation note and the full diff never printed, precisely when the diff was largest. Staging to a file also drops two redundant `git diff` runs.
|
Bito Automatic Review Skipped – PR Already Merged |
SUMMARY
Follow-up to #43841. The failure reported only a line count, so an author seeing red had to regenerate locally to find out what actually changed — which is what happened when
report_formatdrifted in #43910.The diff now renders as markdown on the job summary page, with the
--statheadline above it and the regeneration command inline. The full diff stays in a collapsed log group. The summary copy is truncated at 300 lines, since step summaries cap at 1 MiB and a full regeneration runs to tens of thousands of lines — #43788 was 25,334.TESTING INSTRUCTIONS
Verified by extracting the step body from the workflow and running it under GitHub's shell (
bash -e -o pipefail) against a seeded spec:The large case matters because it is the size of a full regeneration, and it is where output handling breaks if the diff is streamed through
headrather than staged to a file.ADDITIONAL INFORMATION