From a04c583973c896012ed121ba0d3acc4aa1283be5 Mon Sep 17 00:00:00 2001 From: Nuno Fernandes Date: Mon, 23 Nov 2026 17:14:42 +0000 Subject: [PATCH] Auto-approve and merge Dependabot PRs as codacybeta Replace the ahmadnassri auto-merge action with the workflow used in codacy-trivy and quality-integrations-jira: codacybeta (AUTO_MERGE_TOKEN) approves minor/patch Dependabot PRs and enables squash auto-merge. Co-Authored-By: Claude Opus 5.5 --- ...o-merge-dependabot-dependency-updates.yaml | 33 +++++++++++++++++++ .github/workflows/auto-merge.yml | 17 ---------- 2 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/auto-merge-dependabot-dependency-updates.yaml delete mode 100644 .github/workflows/auto-merge.yml diff --git a/.github/workflows/auto-merge-dependabot-dependency-updates.yaml b/.github/workflows/auto-merge-dependabot-dependency-updates.yaml new file mode 100644 index 0000000..b0e87e3 --- /dev/null +++ b/.github/workflows/auto-merge-dependabot-dependency-updates.yaml @@ -0,0 +1,33 @@ +# Automatically merge (using squash) dependency update PRs, opened by Dependabot, under the following conditions: +# +# - PR was opened by dependabot[bot]. +# - Dependency update is a minor or patch update. This is determined based on Dependabot's metadata. +# - Configured required checks pass. +# +# PRs are approved and merged by user codacybeta (https://github.com/orgs/codacy/people/codacybeta), using its +# AUTO_MERGE_TOKEN. +name: Auto-merge Dependabot dependency updates + +on: + pull_request: + +jobs: + auto-merge: + name: Auto-merge Dependabot dependency updates + runs-on: ubuntu-latest + if: github.event.pull_request.user.login == 'dependabot[bot]' + steps: + - name: Checkout repository + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - name: Get Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2 + with: + github-token: ${{ secrets.AUTO_MERGE_TOKEN }} + - name: Approve PR and set it to auto-merge + if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' + run: | + gh pr review --approve ${{ github.event.pull_request.number }} + gh pr merge --squash --auto ${{ github.event.pull_request.number }} + env: + GH_TOKEN: ${{ secrets.AUTO_MERGE_TOKEN }} diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml deleted file mode 100644 index 333346d..0000000 --- a/.github/workflows/auto-merge.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: auto-merge - -on: - pull_request_target: - -jobs: - auto-merge: - runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' - steps: - - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - - uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2 - with: - target: major - github-token: ${{ secrets.GITHUB_TOKEN }}