diff --git a/.github/workflows/approve-bot-pr.yml b/.github/workflows/approve-bot-pr.yml index ee410f89..93881160 100644 --- a/.github/workflows/approve-bot-pr.yml +++ b/.github/workflows/approve-bot-pr.yml @@ -1,4 +1,4 @@ -name: Approve Bot PRs +name: Approve Bot PRs and Enable Auto-Merge on: workflow_run: @@ -60,3 +60,10 @@ jobs: with: token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} number: ${{ needs.download.outputs.pr-number }} + + - name: Enable Auto-Merge + if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' + run: | + gh pr merge ${{ needs.download.outputs.pr-number }} --auto --rebase + env: + GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml deleted file mode 100644 index a3752b0f..00000000 --- a/.github/workflows/auto-merge.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Auto-Merge - -on: - pull_request_review: - types: - - submitted - -jobs: - automerge: - name: Merge or Rebase - if: ${{ github.event.review.user.login == 'paketo-bot-reviewer' }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Fetch Pull Request Details - id: pull_request - env: - NUMBER: ${{ github.event.pull_request.number }} - GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} - run: | - payload="$( - curl "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${NUMBER}" \ - --silent \ - --location \ - --header "Authorization: token ${GITHUB_TOKEN}" - )" - - echo "::set-output name=mergeable_state::$(echo "${payload}" | jq -r -c .mergeable_state)" - - - name: Merge - if: ${{ steps.pull_request.outputs.mergeable_state == 'clean' || steps.pull_request.outputs.mergeable_state == 'unstable' }} - uses: paketo-buildpacks/github-config/actions/pull-request/merge@main - with: - token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} - number: ${{ github.event.pull_request.number }} - - - name: Rebase - if: ${{ steps.pull_request.outputs.mergeable_state == 'behind' }} - uses: paketo-buildpacks/github-config/actions/pull-request/rebase@main - with: - token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} - number: ${{ github.event.pull_request.number }}