Skip to content

Commit 3112eed

Browse files
committed
ci: remove "waiting for reply" label when a PR gets new commits
The stale job only unstales on updated_at, which a push to the head branch does not bump. A contributor answering with code instead of a comment kept the label and got auto-closed.
1 parent 9a7a534 commit 3112eed

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

.github/workflows/stale-waiting-for-reply.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
name: Close stale "waiting for reply" issues and PRs
1+
name: Manage "waiting for reply" issues and PRs
22

33
on:
44
schedule:
55
- cron: '0 2 * * *'
66
workflow_dispatch:
7+
pull_request_target:
8+
types: [synchronize]
79

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

1214
jobs:
1315
stale:
16+
if: github.event_name != 'pull_request_target'
1417
runs-on: ubuntu-latest
1518
steps:
1619
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0
@@ -33,3 +36,22 @@ jobs:
3336
questions. If you're still interested in landing this, answer
3437
them in a comment and we'll reopen.
3538
operations-per-run: 100
39+
40+
# The stale job only unstales on updated_at, which a push to the head branch
41+
# doesn't bump — so a contributor who answers with code instead of a comment
42+
# keeps the label and gets auto-closed.
43+
unlabel-on-push:
44+
if: >
45+
github.event_name == 'pull_request_target' &&
46+
contains(github.event.pull_request.labels.*.name, 'waiting for reply')
47+
runs-on: ubuntu-latest
48+
concurrency:
49+
group: unlabel-waiting-for-reply-${{ github.event.pull_request.number }}
50+
cancel-in-progress: true
51+
steps:
52+
- name: Remove label
53+
env:
54+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
GH_REPO: ${{ github.repository }}
56+
# gh errors when removing a label the PR no longer has — tolerate that.
57+
run: gh pr edit ${{ github.event.pull_request.number }} --remove-label "waiting for reply" || true

0 commit comments

Comments
 (0)