Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/sync-shrinkwrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Sync npm shrinkwrap

on:
pull_request_target:
types:
- opened
- reopened
- synchronize
paths:
- package.json
- package-lock.json
- npm-shrinkwrap.json

concurrency:
group: sync-shrinkwrap-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: read
jobs:
sync:
name: Sync npm-shrinkwrap.json
if: github.actor == 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Check out pull request branch
uses: actions/checkout@v7
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
Comment thread
Copilot marked this conversation as resolved.

- name: Sync npm-shrinkwrap.json
env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
set -euo pipefail

for f in package-lock.json npm-shrinkwrap.json; do
if [ -L "$f" ]; then
echo "$f must not be a symlink"
exit 1
fi
done

rm -f npm-shrinkwrap.json
cp package-lock.json npm-shrinkwrap.json

if git diff --quiet -- npm-shrinkwrap.json; then
echo "npm-shrinkwrap.json already matches package-lock.json"
exit 0
fi
Comment thread
Copilot marked this conversation as resolved.

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add npm-shrinkwrap.json
git commit -m "chore: sync npm shrinkwrap"
git push origin "HEAD:${PR_HEAD_REF}"
74 changes: 52 additions & 22 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.