From de589a457154b777b4d4c649e041314c5ff6d4cf Mon Sep 17 00:00:00 2001 From: Vaibhav Kamra Date: Mon, 12 Jun 2023 12:49:41 -0700 Subject: [PATCH] Use mergequeue for dependabot auto merges (#3594) Keeps the same auto-merge behavior (for `semver-minor` updates) but changes it to use our mergequeue. This improves DX because it prevents dependabot merges from bypassing the queue and also means that sanity tests for these PRs don't fail (they run with the correct env) --- #### Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [ ] :no_entry: No #### Type of change - [ ] :sunflower: Feature - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [ ] :broom: Tech Debt/Cleanup #### Issue(s) * #3591 #### Test Plan - [ ] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- .github/workflows/auto-merge.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index f92ca86c9..6e09338f1 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -1,3 +1,4 @@ +# See https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#common-dependabot-automations name: auto-merge on: @@ -5,11 +6,24 @@ on: paths-ignore: - "src/**" # prevent auto-merge for go dependencies +permissions: + pull-requests: write + jobs: - auto-merge: + auto-approve-label: runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} steps: - - uses: actions/checkout@v3 - - uses: ahmadnassri/action-dependabot-auto-merge@v2 # https://github.com/marketplace/actions/dependabot-auto-merge + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1 with: - github-token: ${{ secrets.DEPENDABOT_TOKEN }} + 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 edit "$PR_URL" --add-label "mergequeue" + gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}