Skip to content

Commit 23dee33

Browse files
jasperboerhofclaude
andcommitted
ci(town-crier): resolve on unlabel — de-announce when the review label is removed
The producer only de-announced on close, and that close-resolve required the label to still be present — so unlabel-then-merge left the request stranded "open" on the town-crier bus forever. Add `unlabeled` to the trigger types and fire /resolve when the "Agent Review Requested" label is removed (the bus no-ops an unknown pr_url, so it's always safe). Announce side unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NzAm5CqhSQTzD3PBuZHyfY
1 parent 45dbc2d commit 23dee33

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/announce-pr.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#
77
# Produces BOTH sides of a request's lifecycle, so the bus never drifts from GitHub:
88
# - announce: when "Agent Review Requested" lands on a PR, tell the crier once.
9-
# - resolve: when that PR closes/merges, retire its thread — otherwise a landed PR
10-
# sits "open" on the bus forever (there is no GitHub->bus merge sync).
9+
# - resolve: when that PR closes/merges or its review label is removed, retire its thread —
10+
# otherwise a landed PR sits "open" on the bus forever (there is no GitHub->bus merge sync).
1111
# Joined harnesses pick up open requests from the bus — this workflow does NOT poll or review.
1212
#
1313
# Failure policy (two distinct modes, so a real problem is never silently masked):
@@ -22,7 +22,7 @@ permissions: {}
2222

2323
on:
2424
pull_request:
25-
types: [labeled, closed]
25+
types: [labeled, unlabeled, closed]
2626

2727
jobs:
2828
announce:
@@ -57,21 +57,28 @@ jobs:
5757
|| echo "::warning::town-crier announce failed (transient bus issue?) — not blocking the PR"
5858
5959
resolve:
60-
if: github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'Agent Review Requested')
60+
if: (github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'Agent Review Requested')) || (github.event.action == 'unlabeled' && github.event.label.name == 'Agent Review Requested')
6161
runs-on: ubuntu-latest
6262
steps:
6363
- name: Resolve on the crier
6464
env:
6565
CRIER_URL: ${{ vars.TOWN_CRIER_URL }}
6666
CRIER_TOKEN: ${{ secrets.TOWN_CRIER_TOKEN }}
6767
PR_URL: ${{ github.event.pull_request.html_url }}
68+
ACTION: ${{ github.event.action }}
6869
MERGED: ${{ github.event.pull_request.merged }}
6970
run: |
7071
if [ -z "$CRIER_URL" ] || [ -z "$CRIER_TOKEN" ]; then
7172
echo "::error::town-crier not provisioned — set the TOWN_CRIER_URL variable + TOWN_CRIER_TOKEN secret"
7273
exit 1
7374
fi
74-
NOTE=$([ "$MERGED" = "true" ] && echo "merged" || echo "closed without merge")
75+
if [ "$ACTION" = "unlabeled" ]; then
76+
NOTE="review label removed"
77+
elif [ "$MERGED" = "true" ]; then
78+
NOTE="merged"
79+
else
80+
NOTE="closed without merge"
81+
fi
7582
curl -fsS --max-time 10 -X POST "$CRIER_URL/resolve" \
7683
-H "Authorization: Bearer $CRIER_TOKEN" \
7784
-H "Content-Type: application/json" \

0 commit comments

Comments
 (0)