Skip to content

Commit 00bf194

Browse files
committed
Automate some GitHub PR status labels manipulations
- Set/remove "Work in Progress"/"Code Review Needed" for drafts. - Remove "Accepted", "Inactive", "Revision Needed" and "Stale" on pushes and reopens. I hope this reduce chances of PRs being forgotten after requested modifications done due to stale labels. It is better to have no labels than incorrect ones saying there is nothing to look at. Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc.
1 parent 91bd12d commit 00bf194

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/labels.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: labels
2+
3+
on:
4+
pull_request_target:
5+
types: [ opened, synchronize, reopened, converted_to_draft, ready_for_review ]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
open:
12+
runs-on: ubuntu-latest
13+
if: ${{ github.event.action == 'opened' && github.event.pull_request.draft }}
14+
steps:
15+
- env:
16+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
ISSUE: ${{ github.event.pull_request.html_url }}
18+
run: |
19+
gh pr edit $ISSUE --add-label "Status: Work in Progress"
20+
21+
push:
22+
runs-on: ubuntu-latest
23+
if: ${{ github.event.action == 'synchronize' || github.event.action == 'reopened' }}
24+
steps:
25+
- env:
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
ISSUE: ${{ github.event.pull_request.html_url }}
28+
run: |
29+
gh pr edit $ISSUE --remove-label "Status: Accepted,Status: Inactive,Status: Revision Needed,Status: Stale"
30+
31+
draft:
32+
runs-on: ubuntu-latest
33+
if: ${{ github.event.action == 'converted_to_draft' }}
34+
steps:
35+
- env:
36+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
ISSUE: ${{ github.event.pull_request.html_url }}
38+
run: |
39+
gh pr edit $ISSUE --remove-label "Status: Accepted,Status: Code Review Needed,Status: Inactive,Status: Revision Needed,Status: Stale" --add-label "Status: Work in Progress"
40+
41+
rfr:
42+
runs-on: ubuntu-latest
43+
if: ${{ github.event.action == 'ready_for_review' }}
44+
steps:
45+
- env:
46+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
ISSUE: ${{ github.event.pull_request.html_url }}
48+
run: |
49+
gh pr edit $ISSUE --remove-label "Status: Accepted,Status: Inactive,Status: Revision Needed,Status: Stale,Status: Work in Progress" --add-label "Status: Code Review Needed"

0 commit comments

Comments
 (0)