From 2f4baeef690d2cc585ed461fb23510d37774146c Mon Sep 17 00:00:00 2001 From: Aarya Mathreja Date: Wed, 10 Jul 2024 09:57:02 -0700 Subject: [PATCH] Update dependabot-auto-merge workflow to call PRW shared workflow --- .github/workflows/dependabot-auto-merge.yml | 38 +++++---------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 7197216..2cdbb19 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -1,12 +1,11 @@ name: Dependabot Pull Request Approve and Merge - on: - push: + push: branches: - 'main' - 'master' - pull_request_target: + pull_request_target: branches: - 'main' - 'master' @@ -14,29 +13,10 @@ on: jobs: dependabot: - runs-on: ubuntu-latest - # Checking the actor will prevent your Action run failing on non-Dependabot - # PRs but also ensures that it only does work for Dependabot PRs. - if: ${{ github.actor == 'dependabot[bot]' }} - steps: - # This first step will fail if there's no metadata and so the approval - # will not occur. - - name: Dependabot metadata - id: dependabot-metadata - uses: dependabot/fetch-metadata@v1.1.1 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - # Here the PR gets approved. - - name: Approve a PR - run: gh pr review --approve "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Finally, this sets the PR to allow auto-merging for patch and minor - # updates if all checks pass - - name: Enable auto-merge for Dependabot PRs - if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} - run: gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + uses: StrongMind/public-reusable-workflows/.github/workflows/shared-dependabot-auto-merge.yml@main + with: + PR_URL: ${{ github.event.pull_request.html_url }} + github_actor: ${{ github.actor }} + secrets: inherit + if: ${{ github.actor == 'dependabot[bot]'}} +