From a40b76399054b55d38ce6d8286cf7688d7d58e90 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Thu, 6 Feb 2025 15:08:49 +0100 Subject: [PATCH 1/2] fix(toil): enable more auto-merge for Dependabot --- .github/dependabot.yml | 12 +++++++++--- .github/workflows/auto-merge.yml | 11 +++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 40dfc0253..890143f15 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -22,6 +22,8 @@ updates: day: 'wednesday' reviewers: - 'stackrox/infra' + labels: + - 'auto-merge' - package-ecosystem: 'docker' directory: 'image/' @@ -30,11 +32,15 @@ updates: day: 'wednesday' reviewers: - 'stackrox/infra' + labels: + - 'auto-merge' - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: 'github-actions' + directory: '/' schedule: interval: 'weekly' day: 'wednesday' reviewers: - - "stackrox/infra" + - 'stackrox/infra' + labels: + - 'auto-merge' diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 156cbdd8c..1a98288e1 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -17,8 +17,15 @@ jobs: with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs - if: steps.metadata.outputs.update-type == 'version-update:semver-minor' - run: gh pr merge --auto --squash "$PR_URL" + if: contains(github.event.pull_request.labels, 'auto-merge') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') + run: gh pr merge --auto --squash "${PR_URL}" env: PR_URL: ${{github.event.pull_request.html_url}} GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: Approve a PR + if: contains(github.event.pull_request.labels, 'auto-merge') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') + run: gh pr review --approve "${PR_URL}" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.RHACS_BOT_GITHUB_TOKEN}} From 60531be833c8920ca546e4f6abcbc390d865a282 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Thu, 6 Feb 2025 15:10:56 +0100 Subject: [PATCH 2/2] order and style --- .github/workflows/auto-merge.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 1a98288e1..589eab5e8 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -15,17 +15,18 @@ jobs: id: metadata uses: dependabot/fetch-metadata@v2 with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Enable auto-merge for Dependabot PRs - if: contains(github.event.pull_request.labels, 'auto-merge') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') - run: gh pr merge --auto --squash "${PR_URL}" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + github-token: "${{ secrets.RHACS_BOT_GITHUB_TOKEN }}" - name: Approve a PR if: contains(github.event.pull_request.labels, 'auto-merge') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') run: gh pr review --approve "${PR_URL}" env: - PR_URL: ${{github.event.pull_request.html_url}} - GH_TOKEN: ${{secrets.RHACS_BOT_GITHUB_TOKEN}} + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.RHACS_BOT_GITHUB_TOKEN }} + + - name: Enable auto-merge for Dependabot PRs + if: contains(github.event.pull_request.labels, 'auto-merge') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') + run: gh pr merge --auto --squash "${PR_URL}" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.RHACS_BOT_GITHUB_TOKEN }}