ci: dedupe all lockfiles conditionally

Only dedupe each lockfile if it was actually changed by Dependabot.
Covers root (Yarn 4) and docs-ui/microsite (Yarn Classic) lockfiles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
This commit is contained in:
Fredrik Adelöw
2026-03-05 17:06:29 +01:00
parent 11d7150b5a
commit 85fcc10e80
@@ -29,11 +29,23 @@ jobs:
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
- name: Dedupe lockfile
- name: Dedupe lockfiles
run: |
corepack enable
yarn dedupe
git add yarn.lock
# Root lockfile (Yarn 4)
if git diff --name-only HEAD~1 | grep -q '^yarn\.lock$'; then
yarn dedupe
git add yarn.lock
fi
# Subdirectory lockfiles (Yarn Classic)
for dir in docs-ui microsite; do
if git diff --name-only HEAD~1 | grep -q "^${dir}/yarn.lock$"; then
npx yarn-deduplicate "$dir/yarn.lock"
git add "$dir/yarn.lock"
fi
done
- name: Generate changeset
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with: