Dependency Dedupe Autofix #123
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Dependency Dedupe Autofix | |
| on: | |
| schedule: | |
| - cron: '10 3 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| actions: write | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: dependency-dedupe-autofix | |
| cancel-in-progress: false | |
| env: | |
| NODE_VERSION: 24.14.0 | |
| PNPM_VERSION: 10.28.2 | |
| jobs: | |
| dedupe-lockfile: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Dedupe lockfile | |
| run: pnpm dedupe --lockfile-only | |
| - name: Create or update autofix PR | |
| id: cpr | |
| uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 | |
| with: | |
| add-paths: pnpm-lock.yaml | |
| base: main | |
| branch: feature/deps-dedupe-autofix | |
| commit-message: 'chore(deps): dedupe pnpm lockfile' | |
| title: 'chore(deps): dedupe pnpm lockfile' | |
| body: | | |
| Keep `pnpm-lock.yaml` deduplicated via the scheduled dependency hygiene workflow. | |
| delete-branch: true | |
| - name: Trigger CI on autofix branch | |
| if: ${{ steps.cpr.outputs.pull-request-operation == 'created' || steps.cpr.outputs.pull-request-operation == 'updated' }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh api \ | |
| --method POST \ | |
| "repos/${{ github.repository }}/actions/workflows/deploy.yml/dispatches" \ | |
| -f ref="${{ steps.cpr.outputs.pull-request-branch }}" | |
| - name: Enable auto-merge | |
| if: ${{ steps.cpr.outputs.pull-request-operation == 'created' || steps.cpr.outputs.pull-request-operation == 'updated' }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh pr merge --auto --squash "${{ steps.cpr.outputs.pull-request-url }}" | |
| - name: Write summary | |
| if: always() | |
| run: | | |
| { | |
| echo "### Dependency dedupe autofix" | |
| echo | |
| echo "- Operation: ${{ steps.cpr.outputs.pull-request-operation || 'none' }}" | |
| echo "- PR: ${{ steps.cpr.outputs.pull-request-url || 'not created' }}" | |
| echo "- Branch: ${{ steps.cpr.outputs.pull-request-branch || 'not created' }}" | |
| } >> "$GITHUB_STEP_SUMMARY" |