Repository navigation
59 lines (49 loc) · 1.71 KB
/
Copy pathmanage_pr_close.yml
File metadata and controls
59 lines (49 loc) · 1.71 KB
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
name: Manage PR Close
on:
pull_request_target:
types:
- closed
permissions:
contents: read
pull-requests: write
concurrency:
group: manage-pr-close-${{ github.event.pull_request.number }}
jobs:
handle-labels:
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:
- id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
# Accepted: PR Merged
- if: github.event.pull_request.merged == true
id: add-labels-accepted
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: gh pr edit "$PR_NUMBER" --add-label 'Accepted'
# Declined: Maintainer/Bot Closed Contributor PR
- if: >-
!github.event.pull_request.merged &&
github.event.pull_request.user.login != github.actor &&
(github.actor == 'refindplusrepo[bot]' || github.actor == 'dakanji')
id: add-labels-declined
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: gh pr edit "$PR_NUMBER" --add-label 'Declined'
# Withdrawn: PR Author Closed PR Themselves
- if: >-
!github.event.pull_request.merged &&
github.event.pull_request.user.login == github.actor
id: add-labels-withdrawn
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: gh pr edit "$PR_NUMBER" --add-label 'Withdrawn'
- id: remove-labels
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: gh pr edit "$PR_NUMBER" --remove-label 'Triage,Queries,Pending,Prorogued'