From 7c3c4e19eaf01f3cae90301dd7b9c07529c767c4 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 4 Sep 2026 17:46:10 +0000 Subject: [PATCH] Enable Dependabot auto-approve and auto-merge for all updates Match proxy-examples / python-proxy-headers / scrapy-proxy-headers: approve and squash-auto-merge every same-repo Dependabot version update (including majors), and split npm groups into minor-patch vs major. Co-authored-by: ProxyMesh AI --- .github/dependabot.yml | 14 ++++++- .github/workflows/dependabot-auto-merge.yml | 41 ++++++++++++++++++--- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 767196c..a70ab5c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,7 @@ version: 2 updates: + # Grouping reduces PR noise; all version updates (including majors) auto-merge via + # .github/workflows/dependabot-auto-merge.yml once required checks pass. - package-ecosystem: "npm" directory: "/" schedule: @@ -17,17 +19,27 @@ updates: update-types: - "minor" - "patch" - dev-all: + prod-major: + dependency-type: "production" + update-types: + - "major" + dev-minor-patch: dependency-type: "development" update-types: - "minor" - "patch" + dev-major: + dependency-type: "development" + update-types: - "major" - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" day: "monday" + labels: + - "dependencies" + - "automerge" groups: actions: patterns: diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index eaafb2b..1023615 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -1,18 +1,47 @@ +# Approve Dependabot pull requests and enable auto-merge so GitHub merges them once +# required status checks pass. Requires: +# - Settings → General → Pull Requests → Allow auto-merge +# - Settings → Actions → General → Allow GitHub Actions to create and approve pull requests +# - Branch protection required status checks (reviews are satisfied by this workflow) +# See: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions +# +# All Dependabot version updates (including majors) are auto-approved and auto-merged. + name: dependabot-auto-merge + on: - pull_request_target + pull_request_target: + types: [opened, reopened, synchronize] + permissions: contents: write pull-requests: write + jobs: automerge: - if: github.actor == 'dependabot[bot]' + # Same-repo Dependabot PRs only. Key off the PR author so synchronize events from + # branch updates (non-Dependabot merge commits) still run. Never check out PR code. + if: > + github.event.pull_request.user.login == 'dependabot[bot]' && + github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - - uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2.5.0 - id: meta - - if: steps.meta.outputs.update-type != 'version-update:semver-major' - run: gh pr merge --auto --squash "$PR" + - name: Approve pull request + run: | + set -euo pipefail + if [ "$(gh pr view "$PR" --json reviewDecision -q .reviewDecision)" != "APPROVED" ]; then + gh pr review --approve "$PR" + fi + env: + PR: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Enable auto-merge + run: | + set -euo pipefail + if [ "$(gh pr view "$PR" --json autoMergeRequest -q '.autoMergeRequest != null')" != "true" ]; then + gh pr merge --auto --squash "$PR" + fi env: PR: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}