-
Notifications
You must be signed in to change notification settings - Fork 4.9k
56 lines (56 loc) · 2.07 KB
/
auto-pr-review.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: '[CI/CD] Automatic PR Review'
on: # rebuild any PRs and main branch changes
pull_request_target:
types:
- synchronize
- labeled
branches:
- main
- bitnami:main
permissions: {}
# Avoid concurrency over the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
auto-pr-review:
runs-on: ubuntu-latest
name: Reviewal for automated PRs
permissions:
pull-requests: write
# This job will be executed when the PR was created by bitnami-bot and it has the 'auto-merge' label
if: |
contains(github.event.pull_request.labels.*.name, 'auto-merge') &&
github.event.pull_request.user.login == 'bitnami-bot'
steps:
# Approve the CI's PR automatically, as it has been tested in our internal pipeline already
# Approved by the 'github-actions' user; a PR can't be approved by its author
- name: PR Approval
uses: hmarr/[email protected]
with:
pull-request-number: ${{ github.event.number }}
- name: Merge
id: merge
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 merge process did not succeed,
# post a comment on the PR and assign a maintainer agent to review it
- name: Manual review required
if: ${{ always() && steps.merge.outcome != 'success' }}
uses: peter-evans/[email protected]
with:
issue-number: ${{ github.event.number }}
# Necessary to trigger support workflows
token: ${{ secrets.BITNAMI_BOT_TOKEN }}
body: |
There has been an error during the automated release process. Manual revision is now required.