Skip to content

Commit 9abce4a

Browse files
committed
ci: add workflow that removes needs review on review
1 parent 38820a3 commit 9abce4a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: remove-needs-review-on-review
2+
3+
on:
4+
pull_request_review:
5+
types:
6+
- submitted
7+
8+
jobs:
9+
remove-needs-review:
10+
name: 🏷️ Remove needs review label
11+
if: github.repository == 'npmx-dev/npmx.dev' && contains(fromJson('["MEMBER","OWNER"]'), github.event.review.author_association)
12+
runs-on: ubuntu-slim
13+
permissions:
14+
issues: write
15+
steps:
16+
- name: 🏷️ Remove needs review label
17+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
18+
with:
19+
script: |
20+
const pr = context.payload.pull_request;
21+
const LABEL = 'needs review';
22+
23+
if (!pr.labels.some(({ name }) => name === LABEL)) {
24+
console.log(`PR #${pr.number} does not have the "${LABEL}" label.`);
25+
return;
26+
}
27+
28+
await github.rest.issues.removeLabel({
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
issue_number: pr.number,
32+
name: LABEL,
33+
});
34+
35+
console.log(`Removed "${LABEL}" from PR #${pr.number}.`);

0 commit comments

Comments
 (0)