Skip to content

Commit

Permalink
ci(restore-node): preserve package.json when replacing packages
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig authored and erights committed Apr 16, 2024
1 parent cf80a91 commit ab10583
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .github/actions/restore-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,23 @@ runs:
sudo apt-get update
sudo apt-get install libbsd-dev
fi
# Preserve the original package.json to restore it after the install.
cp -a package.json package.json.orig
# Replace the Endo packages with the ones built from the checked-out branch.
if test -e ~/endo; then
scripts/get-packed-versions.sh ~/endo | scripts/resolve-versions.sh
fi
yarn install
if ! cmp -s <(git cat-file blob HEAD:package.json) package.json; then
# In the event that the package.json has been modified by Endo
# replacements, we need to have a yarn-installed.sum that matches
# the unmodified package.json. As long as we don't explicitly `yarn
# install` anywhere other than in this action and in the bin/agd
# script, we should be able to reuse even Endo-overridden built caches
# successfully.
git checkout HEAD -- package.json
fi
# Restore the original package.json to preserve its timestamp even if there
# were replacements.
mv package.json.orig package.json
if test -e ~/endo; then
# Stage the redirected `yarn install` consequences.
git add package.json yarn.lock
git add yarn.lock
${{ inputs.keep-endo }} || rm -rf ~/endo
fi
shell: bash
Expand Down

0 comments on commit ab10583

Please sign in to comment.