Repository navigation
ci: list the tarball into a file before the release check greps it (tar | grep -q race) - #128
Merged
Merged
Conversation
`tar -tzf "$TGZ" | grep -qx 'package/lib/index.js'` under pipefail can
fail at random: GNU tar writes the listing one line per write(), grep -q
exits at its match, tar's next write fails ("tar: stdout: write error",
exit 2), and pipefail turns that into "has no lib/index.js", which stops
a release. The same check failed this way in convertapi-library-js's
main build on 2026-11-09.
"Check the package" (publish.yml) now lists the tarball into
$RUNNER_TEMP first and greps the file. The error message is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the release-workflow package-check change.
No open issues 🎉
What changed in this PR
This PR makes the release workflow’s package check more reliable by removing the tar | grep -q pipeline that can falsely report a missing file under pipefail.
Changes:
- Writes the tarball listing to a temporary file before checking for
package/lib/index.js. - Documents the race condition and preserves the existing missing-file error message.
| File | Description |
|---|---|
.github/workflows/publish.yml |
Separates tarball listing from the grep check to prevent premature pipe closure from failing releases. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The "Check the package" step in
publish.ymlchecks the tarball withtar -tzf "$TGZ" | grep -qx 'package/lib/index.js'underset -euo pipefail. That can fail at random and stop a release:write().lib/index.jsis entry 6 of 20, so tar still has 14 lines to write after it.grep -qexits as soon as it matches.tar: stdout: write errorand exits 2.pipefailfails the pipeline, and the||prints a falsehas no lib/index.js.The same check failed this way in convertapi-library-js's
mainbuild on 2026-11-09 (run 42633356489, attempt 1).Change
The step lists the tarball once into
$RUNNER_TEMP/tgz-files.txtand greps that file. The error message is unchanged. A tarball that tar cannot read now stops the step with tar's own error.Tested
In an Ubuntu 24.04 container (GNU tar 1.35, GNU grep 3.11, bash 5.2) with SIGPIPE ignored, as on the runner. The step's
run:script was read frompublish.ymland run withbash -euo pipefailagainst the package built frommain(npm ci,npm run build,npm version 9.9.9-local.1,npm pack), withnpmstubbed to hand over that tarball:maintar: stdout: write error, thenhas no lib/index.js)lib/index.js::error::out/convertapi-9.9.9-local.1.tgz has no lib/index.jspublish.ymlruns only on a release, so it was tested only as above.Same fix in ConvertAPI/convertapi-library-js#31, where the race failed the build. The same defensive change, where nothing fails today: ConvertAPI/convertapi-library-python#65 and ConvertAPI/convertapi-library-java#61.
🤖 Generated with Claude Code