forked from louislam/uptime-kuma
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmark-as-draft-on-requesting-changes.yml
More file actions
56 lines (50 loc) · 1.69 KB
/
mark-as-draft-on-requesting-changes.yml
File metadata and controls
56 lines (50 loc) · 1.69 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
name: Mark PR as draft when changes are requested
on:
pull_request_review:
types: [submitted]
pull_request:
types: [labeled]
permissions: {}
jobs:
mark-draft:
runs-on: ubuntu-latest
if: |
(
github.event_name == 'pull_request_review' &&
github.event.review.state == 'changes_requested'
) || (
github.event_name == 'pull_request' &&
github.event.label.name == 'pr:please address review comments'
)
steps:
- name: Add label on requested changes
if: github.event_name == 'pull_request_review'
env:
GH_TOKEN: ${{ secrets.MARK_AS_DRAFT_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
gh issue edit "$PR_NUMBER" \
--repo "$REPO" \
--add-label "pr:please address review comments"
- name: Mark PR as draft
env:
GH_TOKEN: ${{ secrets.MARK_AS_DRAFT_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: gh pr ready "$PR_URL" --undo || true
ready-for-review:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'ready_for_review'
steps:
- name: Update labels for review
env:
GH_TOKEN: ${{ secrets.MARK_AS_DRAFT_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
gh issue edit "$PR_NUMBER" \
--repo "$REPO" \
--remove-label "pr:please address review comments" || true
gh issue edit "$PR_NUMBER" \
--repo "$REPO" \
--add-label "pr:needs review"