Skip to content

Commit 2fc05c2

Browse files
committed
fix(test): refresh mutable pkg.pr.new installs
1 parent 86b987a commit 2fc05c2

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/scripts/test-pkg-pr-new-migrate.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,22 @@ cache_root="${XDG_CACHE_HOME:-$original_home/.cache}"
6767
pr_home="${VP_PKG_PR_NEW_HOME:-$cache_root/vite-plus/pkg-pr-new/$pr_ref}"
6868
installer_home="$(mktemp -d "${TMPDIR:-/tmp}/vite-plus-pr-installer.XXXXXX")"
6969

70+
# Numeric pkg.pr.new references are mutable PR aliases. The installer reuses a
71+
# version directory named after the reference, so its lockfile can retain the
72+
# checksum from an older publish of the same PR and fail with
73+
# ERR_PNPM_TARBALL_INTEGRITY after the alias is refreshed. Keep the downloaded
74+
# runtime/package-manager cache, but force the wrapper dependency to resolve
75+
# and install again for every PR-alias run. Commit SHA references are immutable
76+
# and can safely retain their installed dependency state.
77+
case "$pr_ref" in
78+
*[!0-9]*) ;;
79+
*)
80+
cached_version_dir="$pr_home/pkg-pr-new-$pr_ref"
81+
rm -rf "$cached_version_dir/node_modules"
82+
rm -f "$cached_version_dir/pnpm-lock.yaml"
83+
;;
84+
esac
85+
7086
cleanup() {
7187
rm -rf "$installer_home"
7288
}

0 commit comments

Comments
 (0)