tools: improve error handling in test426 update script

If the current SHA is not found in the README for some reason,
exit with an error.

PR-URL: https://github.com/nodejs/node/pull/62121
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Rich Trott authored and Antoine du Hamel committed 2026-04-10 14:52:19 +02:00
1 parent fcf2a9f788
commit 840e098e99
1 file changed
+8 -2
@@ -6,11 +6,17 @@ BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
TARGET_DIR="$BASE_DIR/test/fixtures/test426"
README="$BASE_DIR/test/test426/README.md"
TARBALL_URL=$(curl -fsIo /dev/null -w '%header{Location}' https://github.com/tc39/source-map-tests/archive/HEAD.tar.gz)
SHA=$(basename "$TARBALL_URL")
CURRENT_SHA=$(sed -n 's#^.*https://github.com/tc39/source-map-tests/commit/\([0-9a-f]*\).*$#\1#p' "$README")
if [ -z "$CURRENT_SHA" ]; then
echo "Could not find source-map-tests commit marker in $README" >&2
exit 1
fi
TARBALL_URL=$(curl -fsIo /dev/null -w '%header{Location}' https://github.com/tc39/source-map-tests/archive/HEAD.tar.gz)
SHA=$(basename "$TARBALL_URL")
if [ "$CURRENT_SHA" = "$SHA" ]; then
echo "Already up-to-date"
exit 0