Skip to content

Commit dbd4322

Browse files
Copilotmark-wiemer
andauthored
chore: auto-remove "waiting for author" label on author activity (#6213)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mark-wiemer <7833360+mark-wiemer@users.noreply.github.com>
1 parent 037aa8b commit dbd4322

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

‎.github/workflows/remove-waiting-label.yml‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
name: Remove "waiting for author" label on review request
1+
name: Remove "waiting for author" label on author activity
22

33
on:
4+
issue_comment:
5+
pull_request_review_comment:
46
pull_request_target:
5-
types: [review_requested]
7+
types: [review_requested, synchronize]
68

79
permissions:
810
issues: write
911
pull-requests: write
1012

1113
jobs:
1214
remove-label:
13-
if: ${{ !github.event.pull_request.draft }}
15+
if: >-
16+
${{ (github.event_name == 'pull_request_target' && github.event.action == 'review_requested' && !github.event.pull_request.draft) ||
17+
(github.event_name == 'pull_request_target' && github.event.action == 'synchronize') ||
18+
(github.event_name == 'issue_comment' && github.actor == github.event.issue.user.login) ||
19+
(github.event_name == 'pull_request_review_comment' && github.actor == github.event.pull_request.user.login) }}
1420
runs-on: ubuntu-latest
1521

1622
steps:
@@ -19,12 +25,23 @@ jobs:
1925
with:
2026
# REST gives 404 if label isn't present
2127
script: |
28+
const labelName = 'status: waiting for author';
29+
let issueNumber;
30+
31+
if (context.eventName === 'issue_comment') {
32+
issueNumber = context.payload.issue.number;
33+
} else if (context.eventName === 'pull_request_review_comment') {
34+
issueNumber = context.payload.pull_request.number;
35+
} else {
36+
issueNumber = context.payload.pull_request.number;
37+
}
38+
2239
try {
2340
await github.rest.issues.removeLabel({
2441
owner: context.repo.owner,
2542
repo: context.repo.repo,
26-
issue_number: context.payload.pull_request.number,
27-
name: 'status: waiting for author',
43+
issue_number: issueNumber,
44+
name: labelName,
2845
});
2946
} catch (e) {
3047
if (e.status !== 404) throw e;

0 commit comments

Comments
 (0)