-
Notifications
You must be signed in to change notification settings - Fork 2
36 lines (34 loc) · 1.08 KB
/
remove-automerge.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
name: Disable auto-merge
on:
workflow_run:
workflows:
- CI
types:
- completed
permissions:
pull-requests: write
contents: write
jobs:
Run:
runs-on: ubuntu-latest
# pull_request or pull_request_target initiated by dependabot
if: ${{ startsWith(github.event.workflow_run.event, 'pull_request') &&
github.event.workflow.pull_requests[0].auto_merge != null &&
contains(github.event.pull_requests[0].labels.*.name, 'dependencies') }}
steps:
- id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: PR number
run: echo "$PR_NUMBER"
env:
PR_NUMBER: ${{ github.event.workflow.pull_requests[0].number }}
- name: Remove automerge
if: ${{ github.event.workflow.conclusion != 'success' }}
run: |
gh pr merge --disable-auto "$PR_NUMBER"
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
PR_NUMBER: ${{ github.event.workflow.pull_requests[0].number }}