diff --git a/.github/workflows/sync_dependabot-changesets.yml b/.github/workflows/sync_dependabot-changesets.yml index ef0efe04f9..2974407872 100644 --- a/.github/workflows/sync_dependabot-changesets.yml +++ b/.github/workflows/sync_dependabot-changesets.yml @@ -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: