-
Notifications
You must be signed in to change notification settings - Fork 1.1k
46 lines (37 loc) · 1.23 KB
/
pr_automation.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
name: PR automation
on:
pull_request_target:
types:
- opened
- ready_for_review
- converted_to_draft
- synchronize
- labeled
permissions:
pull-requests: write
contents: write
jobs:
pr-automation:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.number }}
steps:
- name: Mark new PR as Draft
if: (github.event.action == 'opened' && github.event.pull_request.draft == false)
run: gh pr ready "$NUMBER" --undo
- name: Set labels on Open
if: github.event.action == 'opened'
run: gh pr edit "$NUMBER" --add-label "WIP"
- name: Set labels on Draft
if: github.event.action == 'converted_to_draft'
run: gh pr edit "$NUMBER" --add-label "WIP" --remove-label "ready-for-review"
- name: Set labels on ready-for-review
if: github.event.action == 'ready_for_review'
run: gh pr edit "$NUMBER" --add-label "ready-for-review" --remove-label "WIP"
- name: Add subproject labels
if: contains('synchronize,opened,reopened', github.event.action)
uses: actions/labeler@v5
with:
sync-labels: true