diff --git a/.github/workflows/automerge.yaml b/.github/workflows/automerge.yaml index d0b4c150b8da..c4d5750fbb35 100644 --- a/.github/workflows/automerge.yaml +++ b/.github/workflows/automerge.yaml @@ -13,40 +13,21 @@ jobs: steps: - uses: hmarr/debug-action@v2 - automerge: - name: Automerge - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' && github.actor == 'nsmbot' }} - outputs: - pr-number: ${{ steps.find-pull-request.outputs.number }} - steps: - - name: Find Pull Request - uses: juliangruber/find-pull-request-action@v1.5.0 - id: find-pull-request - with: - branch: ${{ github.event.workflow_run.head_branch }} + check-mergeability: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + uses: networkservicemesh/.github/.github/workflows/check-mergeability.yaml@main + secrets: + token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} - - name: Merge PR - uses: ridedott/merge-me-action@master - if: steps.find-pull-request.outputs.number - with: - GITHUB_LOGIN: nsmbot - ENABLED_FOR_MANUAL_CHANGES: true - GITHUB_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} - MAXIMUM_RETRIES: 25 - - delete-release-branch: - name: Delete Release Branch + automerge: + needs: [check-mergeability] + if: ${{ needs.check-mergeability.outputs.pr_branch_ref != '' }} runs-on: ubuntu-latest - needs: automerge - if: ${{ needs.automerge.outputs.pr-number && contains(github.event.workflow_run.head_branch, 'release/') }} steps: - - uses: actions/checkout@v2 - with: - token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} + - name: Check out the code + uses: actions/checkout@v4 - - name: Delete release branch - run: | - git config --global user.email "nsmbot@networkservicmesh.io" - git config --global user.name "NSMBot" - git push origin --delete ${{ github.event.workflow_run.head_branch }} + - name: Automerge + run: gh pr merge ${{ github.event.workflow_run.head_branch }} --squash --delete-branch + env: + GH_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}