From 2500471c00917942414a12ffa8c54c104596f7e6 Mon Sep 17 00:00:00 2001 From: Tomas Rutkauskas Date: Mon, 9 Nov 2026 17:37:17 +0200 Subject: [PATCH] ci: list the tarball into a file before grep -q checks it `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 --- .github/workflows/publish.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d971df1..923933c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -176,7 +176,10 @@ jobs: test -f "$TGZ" PKG_JSON=$(tar -xzOf "$TGZ" package/package.json) [ "$(jq -r .version <<<"$PKG_JSON")" = "$VERSION" ] || { echo "::error::$TGZ does not carry version $VERSION"; exit 1; } - tar -tzf "$TGZ" | grep -qx 'package/lib/index.js' || { echo "::error::$TGZ has no lib/index.js"; exit 1; } + # The listing goes to a file first. Piped into grep -q, tar can still be writing when grep exits + # at its first match; tar then fails ("stdout: write error") and pipefail reports a missing file. + tar -tzf "$TGZ" > "$RUNNER_TEMP/tgz-files.txt" + grep -qx 'package/lib/index.js' "$RUNNER_TEMP/tgz-files.txt" || { echo "::error::$TGZ has no lib/index.js"; exit 1; } tar -tzf "$TGZ" # Trusted Publishing: once npmjs.com trusts this repository, publish.yml and the npm environment,