chore(deps): bump the npm-safe-updates group with 2 updates #2
Workflow file for this run
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: Dependabot auto-merge | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| auto-merge: | |
| name: Auto-merge safe Dependabot updates | |
| if: github.actor == 'dependabot[bot]' && github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Classify update | |
| id: classify | |
| env: | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| run: | | |
| node <<'NODE' | |
| const fs = require("node:fs") | |
| const title = process.env.PR_TITLE ?? "" | |
| const match = title.match(/\bfrom\s+v?(\d+)(?:\.\d+)*\s+to\s+v?(\d+)(?:\.\d+)*/i) | |
| const isMajor = Boolean(match && match[1] !== match[2]) | |
| fs.appendFileSync(process.env.GITHUB_OUTPUT, `is_major=${isMajor}\n`) | |
| console.log(isMajor ? "Major update detected; leaving PR for manual review." : "Safe update detected; enabling auto-merge.") | |
| NODE | |
| - name: Enable auto-merge after required checks pass | |
| if: steps.classify.outputs.is_major != 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR_URL: ${{ github.event.pull_request.html_url }} | |
| run: gh pr merge --auto --squash --delete-branch "$PR_URL" |