diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f24116134..a43856827 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,8 +5,44 @@ version: 2 updates: - - package-ecosystem: "uv" # See documentation for possible values - directory: "/" # Location of package manifests + - package-ecosystem: "uv" + directory: "/" schedule: interval: "weekly" + day: "monday" + time: "09:00" + timezone: "America/Denver" target-branch: "staging" + open-pull-requests-limit: 5 + rebase-strategy: "auto" + labels: + - "dependencies" + - "python" + groups: + uv-non-major: + patterns: + - "*" + update-types: + - "minor" + - "patch" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "09:00" + timezone: "America/Denver" + target-branch: "staging" + open-pull-requests-limit: 5 + rebase-strategy: "auto" + labels: + - "dependencies" + - "github-actions" + groups: + gha-minor-and-patch: + patterns: + - "*" + update-types: + - "minor" + - "patch" diff --git a/.github/workflows/dependabot_automerge.yml b/.github/workflows/dependabot_automerge.yml new file mode 100644 index 000000000..7f45fe27b --- /dev/null +++ b/.github/workflows/dependabot_automerge.yml @@ -0,0 +1,58 @@ +name: Dependabot auto-merge + +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +permissions: + contents: write + pull-requests: write + +jobs: + automerge: + if: github.actor == 'dependabot[bot]' && github.event.pull_request.user.login == 'dependabot[bot]' + runs-on: ubuntu-latest + + steps: + - name: Fetch Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + # Auto-approve (only matters if your branch protection requires reviews) + - name: Approve PR + if: steps.metadata.outputs.update-type != 'version-update:semver-major' + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { data: reviews } = await github.rest.pulls.listReviews({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }); + + const alreadyApprovedByBot = reviews.some( + (review) => + review.state === "APPROVED" && + review.user?.login === "github-actions[bot]" + ); + + if (!alreadyApprovedByBot) { + await github.rest.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + event: "APPROVE", + }); + } + + # Enable GitHub auto-merge; it will merge once required checks (your Test Suite) are green + - name: Enable auto-merge (squash) + if: steps.metadata.outputs.update-type != 'version-update:semver-major' + uses: peter-evans/enable-pull-request-automerge@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + pull-request-number: ${{ github.event.pull_request.number }} + merge-method: squash