From 7f41783693d11d6b16d72ef33fbbed6bc418b810 Mon Sep 17 00:00:00 2001 From: Thomas Belin Date: Wed, 24 Jan 2024 16:06:55 +0100 Subject: [PATCH] chore: Auto merge PR from otto-the-bot and dependabot (#16616) * chore: Auto merge PR from otto-the-bot and dependabot * removeme * fix config * fixup --- .../workflows/cherry-pick-release-to-dev.yml | 9 +------ .github/workflows/dependabot-auto-merge.yml | 25 ------------------- .github/workflows/pr-auto-merge.yml | 18 ++++++------- 3 files changed, 8 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/dependabot-auto-merge.yml diff --git a/.github/workflows/cherry-pick-release-to-dev.yml b/.github/workflows/cherry-pick-release-to-dev.yml index a675eb655fb..d97a158a8c9 100644 --- a/.github/workflows/cherry-pick-release-to-dev.yml +++ b/.github/workflows/cherry-pick-release-to-dev.yml @@ -24,11 +24,4 @@ jobs: with: pr_branch: 'dev' env: - GITHUB_TOKEN: ${{ secrets.OTTO_THE_BOT_GH_TOKEN }} - - # Add the auto-merge flag - - name: Enable auto-merge - run: gh pr edit ${{ github.event.pull_request.id }} --add-label auto-merge - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{secrets.OTTO_THE_BOT_GH_TOKEN}} diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml deleted file mode 100644 index 5177432e5e5..00000000000 --- a/.github/workflows/dependabot-auto-merge.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Dependabot auto-merge -on: pull_request_target - -permissions: - pull-requests: write - contents: write - -jobs: - activate-auto-merge: - runs-on: ubuntu-latest - if: ${{github.actor == 'dependabot[bot]'}} - steps: - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@v1.6.0 - with: - github-token: '${{secrets.WEBTEAM_AUTOMERGE_TOKEN}}' - - # Add the auto-merge flag if the PR is a minor or patch version update - - name: Enable auto-merge for minor and patch updates - if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'}} - run: gh pr edit ${{ github.event.pull_request.id }} --add-label auto-merge - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/pr-auto-merge.yml b/.github/workflows/pr-auto-merge.yml index a0b27d10ec3..5e25351f33f 100644 --- a/.github/workflows/pr-auto-merge.yml +++ b/.github/workflows/pr-auto-merge.yml @@ -1,26 +1,22 @@ -name: auto-merge flagged PR -on: - pull_request: - types: ['labeled'] +name: auto-merge PR +on: pull_request permissions: pull-requests: write contents: write -## This job will auto merge PR that has been labeled with 'auto-merge' +# This job will enable auto merge on dependabots and otto-the-bot's PRs jobs: activate-auto-merge: runs-on: ubuntu-latest - if: ${{ github.event.label.name == 'auto-merge' }} + if: ${{github.actor == 'dependabot[bot]' || github.actor == 'otto-the-bot'}} steps: - name: Approve PR - run: gh pr review --approve "$PR_URL" + run: gh pr review --approve ${{github.event.pull_request.html_url}} env: - PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Enable auto-merge - run: gh pr merge --auto --squash "$PR_URL" + run: gh pr merge --auto --squash ${{github.event.pull_request.html_url}} env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.WEBTEAM_AUTOMERGE_TOKEN}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}