fix(deps): bump the prod-minor-patch group across 1 directory with 15 updates #499
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: Regenerate Dependabot Lockfile | |
| # Regenerates pnpm-lock.yaml on dependabot PRs and pushes the update back to | |
| # the PR branch. Fixing CI failures on the regenerated lockfile is handled by | |
| # the separate dependabot-claude-fix workflow, which triggers via workflow_run | |
| # after the CI workflows finish — so we no longer poll for check results here. | |
| on: | |
| pull_request_target: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| regen-lockfile: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Check if Dependabot PR | |
| id: guard | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR_AUTHOR: ${{ github.event.pull_request.user.login }} | |
| HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| run: | | |
| if [[ "$PR_AUTHOR" != "dependabot[bot]" ]]; then | |
| echo "Not a Dependabot PR (author: $PR_AUTHOR), nothing to do." | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| # Prevent infinite loops: count how many times this workflow has already | |
| # run successfully on this branch (max 20 attempts) | |
| RUN_COUNT=$(gh api "repos/${{ github.repository }}/actions/workflows/dependabot-lockfile.yml/runs?branch=$HEAD_REF&status=success" --jq '.total_count') | |
| if [[ "$RUN_COUNT" -ge 20 ]]; then | |
| echo "Already ran $RUN_COUNT times on this branch, skipping to prevent loop." | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| - name: Generate App Token | |
| if: steps.guard.outputs.skip != 'true' | |
| id: generate-token | |
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3 | |
| with: | |
| app-id: ${{ secrets.CI_APP_ID }} | |
| private-key: ${{ secrets.CI_APP_PRIVATE_KEY }} | |
| permissions: >- | |
| contents:write | |
| - name: Checkout Dependabot branch | |
| if: steps.guard.outputs.skip != 'true' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Set up pnpm | |
| if: steps.guard.outputs.skip != 'true' | |
| uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6 | |
| with: | |
| version: 10 | |
| - name: Set up Node.js | |
| if: steps.guard.outputs.skip != 'true' | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: "22.x" | |
| - name: Configure git identity | |
| if: steps.guard.outputs.skip != 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Regenerate lockfile | |
| if: steps.guard.outputs.skip != 'true' | |
| run: pnpm install --no-frozen-lockfile --ignore-scripts | |
| - name: Commit lockfile changes | |
| if: steps.guard.outputs.skip != 'true' | |
| run: | | |
| if git diff --quiet pnpm-lock.yaml; then | |
| echo "No lockfile changes." | |
| else | |
| git add pnpm-lock.yaml | |
| git commit -m "fix(deps): regenerate pnpm-lock.yaml" | |
| git push | |
| fi |