[bitnami/*] Merge automated PRs instead of enabling auto-merge (#16824)

[bitnami/*] Merge automated PRs once tests run ok

Signed-off-by: Fran Mulero <fmulero@vmware.com>
This commit is contained in:
Fran Mulero
2022-12-14 08:28:33 +01:00
committed by GitHub
parent e879f2d477
commit 7a0ea47a69

View File

@@ -165,21 +165,33 @@ jobs:
contains(github.event.pull_request.labels.*.name, 'auto-merge') &&
github.event.pull_request.user.login == 'bitnami-bot'
steps:
- name: Enable auto-merge feature
if: ${{ needs.verification-summary.outputs.result == 'success' }}
uses: reitermarkus/automerge@v2.2.0
with:
# Necessary to trigger CD workflow
token: ${{ secrets.BITNAMI_BOT_TOKEN }}
merge-method: squash
pull-request: ${{ github.event.number }}
# Approve the CI's PR if the 'VIB Verify' job succeeded
# Approved by the 'github-actions' user; a PR can't be approved by its author
- name: PR Approval
if: ${{ needs.verification-summary.outputs.result == 'success' }}
uses: hmarr/auto-approve-action@v3.0.0
with:
pull-request-number: ${{ github.event.number }}
- name: Merge
id: merge
if: ${{ needs.verification-summary.outputs.result == 'success' }}
uses: actions/github-script@v6
with:
result-encoding: string
retries: 3
# Necessary to trigger CD workflows
github-token: ${{ secrets.BITNAMI_BOT_TOKEN }}
script: |
github.rest.pulls.merge({
pull_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
merge_method: 'squash'
})
# If the CI did not succeed ('VIB Verify' failed or skipped),
# post a comment on the PR and assign a maintainer agent to review it
- name: Manual review required
if: ${{ needs.verification-summary.outputs.result != 'success' }}
if: ${{ always() && (needs.verification-summary.outputs.result != 'success' || steps.merge.outcome != 'success') }}
uses: peter-evans/create-or-update-comment@v2.0.0
with:
issue-number: ${{ github.event.number }}