-
Notifications
You must be signed in to change notification settings - Fork 197
61 lines (52 loc) · 1.79 KB
/
auto-merge.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
57
58
59
60
61
name: Auto Merge
on:
workflow_run:
workflows: [ Gather Pull Request Metadata ]
types:
- completed
permissions:
contents: read
jobs:
download-metadata:
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
outputs:
pr-metadata: ${{ steps.Artifact.outputs.pr-metadata-json }}
steps:
- id: Artifact
name: Download Artifact
uses: redhat-plumbers-in-action/download-artifact@v1
with:
name: pr-metadata
auto-merge:
needs: [ download-metadata ]
runs-on: ubuntu-latest
permissions:
# required for ability to merge Pull Request
contents: write
# required for setting labels
pull-requests: write
steps:
- id: pull-request-validator
name: Pull Request Validator
uses: redhat-plumbers-in-action/pull-request-validator@v2
with:
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
token: ${{ secrets.GITHUB_TOKEN }}
- id: auto-merge
name: Auto Merge
uses: redhat-plumbers-in-action/auto-merge@v2
with:
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
token: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ !cancelled() }}
name: Show results in PR comment
uses: redhat-plumbers-in-action/issue-commentator@v1
with:
issue: ${{ fromJSON(needs.download-metadata.outputs.pr-metadata).number }}
message: |
${{ steps.pull-request-validator.outputs.status && steps.pull-request-validator.outputs.status || '' }}
${{ steps.auto-merge.outputs.status && steps.auto-merge.outputs.status || '' }}
token: ${{ secrets.GITHUB_TOKEN }}