-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 2.37 KB
/
pr-help.managed.yaml
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
# THIS CODE WAS AUTOGENERATED. DO NOT MODIFY THIS FILE DIRECTLY
# THE SOURCE CODE LIVES IN A DIFFERENT REPOSITORY:
# - centralized-templates
# FILE STEWARD: @pleo-io/team-devx,@pleo-bot-auto-approver
name: Automate PR
on:
pull_request:
# This workflow is triggered for each individual label that was added / removed
# It is necessary to detect the actual label in each job / step
types:
- labeled
- unlabeled
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}-${{ github.event.label.name }}
cancel-in-progress: true
env:
autoApproveEnabled: true
jobs:
auto-approve-pr:
runs-on: ubuntu-latest
name: Auto-approve PR
if: ${{ contains(fromJSON('["pleo-bot-renovate", "pleo-bot", "pleo-file-distributor[bot]"]'), github.actor) && github.event.label.name == 'autoapprove' }}
steps:
- uses: hmarr/auto-approve-action@v3
if: ${{ github.event.action == 'labeled' && env.autoApproveEnabled == 'true' }}
with:
github-token: ${{ secrets.PLEO_BOT_AUTO_APPROVER_TOKEN }}
review-message: "This has been auto-approved by @pleo-bot-auto-approver. If your PR isn't being auto-merged as desired, make sure to add @pleo-bot-auto-approver to the CODEOWNERS file. More details how to use Renovate [here](https://www.notion.so/pleo/How-to-use-Renovate-781e4861200744c6b38d3efd8c6d525a?pvs=4)"
automerge-pr:
# This job is used to to replace Kodiak which fails in repos that use Github's merge queue
# The main use case is to automerge PRs created by file-distirbutor
name: Detecting Label "automerge"
runs-on: ubuntu-latest
if: ${{ github.event.label.name == 'automerge' }}
steps:
- name: Checkout code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- id: enable-automerge
name: Enable Pull Request Automerge
if: ${{github.event.action == 'labeled'}}
run: gh pr merge --auto --squash "$PR_NUMBER"
env:
GITHUB_TOKEN: "${{ secrets.PLEO_BOT_AUTO_APPROVER_TOKEN }}"
PR_NUMBER: ${{ github.event.number }}
- id: disable-automerge
name: Disable Pull Request Automerge
if: ${{github.event.action == 'unlabeled'}}
run: gh pr merge --disable-auto "$PR_NUMBER"
env:
GITHUB_TOKEN: "${{ secrets.PLEO_BOT_AUTO_APPROVER_TOKEN }}"
PR_NUMBER: ${{ github.event.number }}