From 8f6a7eedc28f69218be1893941698c63526cf210 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 28 Aug 2021 21:32:29 +0000 Subject: [PATCH] File sync from s4u/.github - Auto Approve by gh cli --- .github/workflows/auto-approve.yml | 33 +++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index e834cbb..4e4d0c2 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -1,25 +1,38 @@ -name: Auto approve +name: Auto Approve on: pull_request_target +permissions: + pull-requests: write + contents: write + jobs: auto-approve: runs-on: ubuntu-latest steps: - - uses: alexwilson/enable-github-automerge-action@1.0.0 + - name: Dependabot metadata + if: github.actor == 'dependabot[bot]' + id: dependabot-metadata + uses: dependabot/fetch-metadata@v1.1.1 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Enable auto-merge for Dependabot PRs if: > github.actor == 'dependabot[bot]' - || github.actor == 'dependabot-preview[bot]' - with: - merge-method: "REBASE" - github-token: "${{ secrets.TECH_TOKEN }}" + && steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' + run: gh pr merge --auto --rebase "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: hmarr/auto-approve-action@v2.1.0 + - name: Approve a PR if: > github.actor == 'dependabot[bot]' - || github.actor == 'dependabot-preview[bot]' || github.actor == 'slawekjaranowski' - with: - github-token: "${{ secrets.TECH_TOKEN }}" + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}