diff --git a/.github/chainguard/dependabot-automation.sts.yaml b/.github/chainguard/dependabot-automation.sts.yaml new file mode 100644 index 00000000..1004a4fb --- /dev/null +++ b/.github/chainguard/dependabot-automation.sts.yaml @@ -0,0 +1,13 @@ +issuer: https://token.actions.githubusercontent.com + +subject: repo:DataDog/action-prebuildify:pull_request + +claim_pattern: + actor: dependabot\[bot\] + event_name: pull_request + ref: refs/pull/[0-9]+/merge + job_workflow_ref: DataDog/action-prebuildify/\.github/workflows/dependabot-automation.yml@refs/pull/[0-9]+/merge + +permissions: + contents: write + pull_requests: write diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d56228f5..ef3012f9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,8 +3,111 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "weekly" open-pull-requests-limit: 10 + groups: + github-actions: + patterns: + - "*" + update-types: + - "minor" + - "patch" + commit-message: + prefix: "chore" + include: "scope" + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + groups: + development-dependencies: + dependency-type: "development" + patterns: + - "*" + update-types: + - "minor" + - "patch" + production-dependencies: + dependency-type: "production" + patterns: + - "*" + update-types: + - "minor" + - "patch" + commit-message: + prefix: "chore" + include: "scope" + + - package-ecosystem: "npm" + directory: "/prebuild" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + groups: + development-dependencies: + dependency-type: "development" + patterns: + - "*" + update-types: + - "minor" + - "patch" + production-dependencies: + dependency-type: "production" + patterns: + - "*" + update-types: + - "minor" + - "patch" + commit-message: + prefix: "chore" + include: "scope" + + - package-ecosystem: "npm" + directory: "/test/napi" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + groups: + development-dependencies: + dependency-type: "development" + patterns: + - "*" + update-types: + - "minor" + - "patch" + production-dependencies: + dependency-type: "production" + patterns: + - "*" + update-types: + - "minor" + - "patch" + commit-message: + prefix: "chore" + include: "scope" + + - package-ecosystem: "npm" + directory: "/test/neon" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + groups: + development-dependencies: + dependency-type: "development" + patterns: + - "*" + update-types: + - "minor" + - "patch" + production-dependencies: + dependency-type: "production" + patterns: + - "*" + update-types: + - "minor" + - "patch" commit-message: prefix: "chore" include: "scope" diff --git a/.github/workflows/dependabot-automation.yml b/.github/workflows/dependabot-automation.yml new file mode 100644 index 00000000..0f092950 --- /dev/null +++ b/.github/workflows/dependabot-automation.yml @@ -0,0 +1,49 @@ +name: "Dependabot Automation" + +on: + pull_request: + types: + - opened + - reopened + - synchronize + +env: + AUTO_MERGE_GROUP: "development-dependencies" + +jobs: + dependabot-automation: + # Do not mint a token when a human reopens or synchronizes a Dependabot PR. + if: github.event.pull_request.user.login == 'dependabot[bot]' && github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + permissions: + id-token: write + pull-requests: read + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # 3.1.0 + - name: Get GitHub token via Octo STS + if: >- + steps.metadata.outputs.dependency-group == env.AUTO_MERGE_GROUP && + steps.metadata.outputs.update-type != 'version-update:semver-major' + uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4 + id: octo-sts + with: + scope: DataDog/action-prebuildify + policy: dependabot-automation + - name: Approve a PR + if: >- + steps.metadata.outputs.dependency-group == env.AUTO_MERGE_GROUP && + steps.metadata.outputs.update-type != 'version-update:semver-major' + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ steps.octo-sts.outputs.token }} + - name: Enable auto-merge for Dependabot PRs + if: >- + steps.metadata.outputs.dependency-group == env.AUTO_MERGE_GROUP && + steps.metadata.outputs.update-type != 'version-update:semver-major' + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ steps.octo-sts.outputs.token }}