From 2ebcf1934666a71309bb42a1954ffc8074f6821b Mon Sep 17 00:00:00 2001 From: Weston Steimel Date: Wed, 17 Jan 2024 10:49:55 +0000 Subject: [PATCH] chore: disable auto merging of dependabot PRs (#456) Disabling dependabot PR auto merge due to the issues encountered with them not triggering the expected workflows on commit to main Signed-off-by: Weston Steimel --- .github/workflows/dependabot-auto-merge.yaml | 48 -------------------- 1 file changed, 48 deletions(-) delete mode 100644 .github/workflows/dependabot-auto-merge.yaml diff --git a/.github/workflows/dependabot-auto-merge.yaml b/.github/workflows/dependabot-auto-merge.yaml deleted file mode 100644 index 266f51d3..00000000 --- a/.github/workflows/dependabot-auto-merge.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# see https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request - -name: Dependabot auto-merge -on: pull_request - -permissions: - contents: write - pull-requests: write - -jobs: - dependabot: - runs-on: ubuntu-latest - if: github.event.pull_request.user.login == 'dependabot[bot]' # not necessarily actor; needs to run on human push to dependabot PR - steps: - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@c9c4182bf1b97f5224aee3906fd373f6b61b4526 # v1.6.0 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Check whether anyone besides dependabot has pushed - id: pr_author - run: | - EXTRA_AUTHORS=$(gh pr view "$PR_URL" --json commits --jq '.commits[] | .authors[] | .login' | sort | uniq | grep -v dependabot || echo -n '') - if [ -n "$EXTRA_AUTHORS" ]; then - echo "PR has authors in addition to dependabot: $EXTRA_AUTHORS" - echo "human_pushed=true" >> "$GITHUB_OUTPUT" - else - echo "human_pushed=false" >> "$GITHUB_OUTPUT" - fi - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Enable auto-merge for Dependabot PRs - if: > - ( steps.pr_author.human_pushed != 'true' ) && - ( steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' ) - run: gh pr merge --auto --squash "$PR_URL" && gh pr review --approve "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Disable auto-merge if human modified PR - if: steps.pr_author.human_pushed == 'true' - run: | - echo "disabling auto-merge due to non-dependabot push" - gh pr merge --disable-auto "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}