Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .github/workflows/announce-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#
# Produces BOTH sides of a request's lifecycle, so the bus never drifts from GitHub:
# - announce: when "Agent Review Requested" lands on a PR, tell the crier once.
# - resolve: when that PR closes/merges, retire its thread — otherwise a landed PR
# sits "open" on the bus forever (there is no GitHub->bus merge sync).
# - resolve: when that PR closes/merges or its review label is removed, retire its thread —
# otherwise a landed PR sits "open" on the bus forever (there is no GitHub->bus merge sync).
# Joined harnesses pick up open requests from the bus — this workflow does NOT poll or review.
#
# Failure policy (two distinct modes, so a real problem is never silently masked):
Expand All @@ -22,7 +22,7 @@ permissions: {}

on:
pull_request:
types: [labeled, closed]
types: [labeled, unlabeled, closed]

jobs:
announce:
Expand Down Expand Up @@ -57,21 +57,28 @@ jobs:
|| echo "::warning::town-crier announce failed (transient bus issue?) — not blocking the PR"

resolve:
if: github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'Agent Review Requested')
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')
runs-on: ubuntu-latest
steps:
- name: Resolve on the crier
env:
CRIER_URL: ${{ vars.TOWN_CRIER_URL }}
CRIER_TOKEN: ${{ secrets.TOWN_CRIER_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
ACTION: ${{ github.event.action }}
MERGED: ${{ github.event.pull_request.merged }}
run: |
if [ -z "$CRIER_URL" ] || [ -z "$CRIER_TOKEN" ]; then
echo "::error::town-crier not provisioned — set the TOWN_CRIER_URL variable + TOWN_CRIER_TOKEN secret"
exit 1
fi
NOTE=$([ "$MERGED" = "true" ] && echo "merged" || echo "closed without merge")
if [ "$ACTION" = "unlabeled" ]; then
NOTE="review label removed"
elif [ "$MERGED" = "true" ]; then
NOTE="merged"
else
NOTE="closed without merge"
fi
curl -fsS --max-time 10 -X POST "$CRIER_URL/resolve" \
-H "Authorization: Bearer $CRIER_TOKEN" \
-H "Content-Type: application/json" \
Expand Down
Loading