Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework Automerge workflow #11843

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 14 additions & 33 deletions .github/workflows/automerge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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 "[email protected]"
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 }}
Loading