#!/usr/bin/env bash # Fetch the full issue thread (shared memory) into /tmp/thread.md. # # Required env (provided by the workflow step): GT NUM GITHUB_SERVER_URL GITHUB_REPOSITORY set -eu API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}" curl -sS -H "Authorization: token $GT" "$API/issues/$NUM/comments?limit=100" 2>/dev/null \ | jq -r '.[] | ( if (.body | test("delegated by")) then "an automated delegation" elif (.user.login == "ffaerber") then "ffaerber (the maintainer / you)" else "an AI teammate — the specific one is named in the 🤖 @name line at the top of the comment" end ) as $who | "### comment by \($who):\n\(.body)\n"' > /tmp/thread.md 2>/dev/null || true echo "thread comments fetched: $(grep -c '^### comment by ' /tmp/thread.md 2>/dev/null || echo 0)"