Skip to content

Commit 76de08f

Browse files
committed
fix: handle npm pack output when comparing tarballs
1 parent 76ea0b2 commit 76de08f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ runs:
124124
TMP_DIR="$(mktemp -d)"
125125
trap 'rm -rf "$TMP_DIR"' EXIT
126126
127-
if ! REMOTE_TARBALL="$(npm pack "${PKG_NAME}@${LATEST_VERSION}" --silent --pack-destination "$TMP_DIR" 2>/dev/null)"; then
127+
if ! REMOTE_TARBALL="$(npm pack "${PKG_NAME}@${LATEST_VERSION}" --silent --pack-destination "$TMP_DIR" 2>/dev/null | tail -n 1)"; then
128128
echo "Unable to download ${PKG_NAME}@${LATEST_VERSION}; proceeding with release."
129129
echo "should_release=true" >> "$GITHUB_OUTPUT"
130130
exit 0
131131
fi
132132
133-
if ! LOCAL_TARBALL="$(cd "$PKG_DIR" && npm pack --silent --pack-destination "$TMP_DIR")"; then
133+
if ! LOCAL_TARBALL="$(cd "$PKG_DIR" && npm pack --silent --pack-destination "$TMP_DIR" | tail -n 1)"; then
134134
echo "Unable to pack local ${PKG_NAME}; proceeding with release."
135135
echo "should_release=true" >> "$GITHUB_OUTPUT"
136136
exit 0
@@ -140,6 +140,9 @@ runs:
140140
REMOTE_DIR="${TMP_DIR}/remote"
141141
mkdir -p "$LOCAL_DIR" "$REMOTE_DIR"
142142
143+
LOCAL_TARBALL="$(basename "$LOCAL_TARBALL")"
144+
REMOTE_TARBALL="$(basename "$REMOTE_TARBALL")"
145+
143146
tar -xzf "${TMP_DIR}/${LOCAL_TARBALL}" -C "$LOCAL_DIR"
144147
tar -xzf "${TMP_DIR}/${REMOTE_TARBALL}" -C "$REMOTE_DIR"
145148

0 commit comments

Comments
 (0)