fix(agent): route issue-opened events (event_name is workflow_call in reusable wf)
The shared agent.yml is a reusable (workflow_call) workflow, so on Gitea github.event_name evaluates to 'workflow_call' — not the original 'issues'/ 'issue_comment'. route.sh branched on EVENT == "issues", so issue-opened runs scanned the empty comment body and skipped the @pm fallback, exiting 1 with "no known agent mentioned" (runs #393/#394). Comment runs were unaffected because the @mention lives in $BODY. Discriminate on the comment id (CID) instead, which IS reliably forwarded in the event payload: empty => issue-opened (scan issue body, default @pm), set => comment (scan comment body). Also add .gitignore for .env. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d8d4ba71c0
commit
b3deee7412
@@ -4,7 +4,7 @@
|
||||
# /tmp/agents.json, picks which agent to run, emits step outputs (name/model/vision/mode/branch/new)
|
||||
# to $GITHUB_OUTPUT, configures git identity, and prepares/publishes the working branch.
|
||||
#
|
||||
# Required env (all provided by the workflow step): BODY IBODY EVENT IS_PR NUM GT
|
||||
# Required env (all provided by the workflow step): BODY IBODY CID IS_PR NUM GT
|
||||
# TOKEN_PM TOKEN_SENIOR TOKEN_JUNIOR TOKEN_LEAD TOKEN_QA
|
||||
# GITHUB_SERVER_URL GITHUB_REPOSITORY GITHUB_OUTPUT
|
||||
set -eu
|
||||
@@ -26,13 +26,15 @@ cat > /tmp/agents.json <<'JSON'
|
||||
}
|
||||
JSON
|
||||
# On a new issue, @pm auto-assesses. On a comment, route by the @mention.
|
||||
scan="$BODY"; [ "$EVENT" = "issues" ] && scan="$IBODY"
|
||||
# A comment event has a comment id (CID); an issue-opened event does not. (event_name is unreliable
|
||||
# here — see agent.yml: this reusable workflow sees it as 'workflow_call'.)
|
||||
if [ -n "$CID" ]; then scan="$BODY"; else scan="$IBODY"; fi
|
||||
name=""
|
||||
for a in pm junior senior lead qa; do
|
||||
case "$scan" in *"@$a"*) name=$a; break;; esac
|
||||
done
|
||||
if [ -z "$name" ]; then
|
||||
if [ "$EVENT" = "issues" ]; then name=pm; else echo "no known agent mentioned"; exit 1; fi
|
||||
if [ -z "$CID" ]; then name=pm; else echo "no known agent mentioned"; exit 1; fi
|
||||
fi
|
||||
model=$(jq -r --arg a "$name" '.[$a].model' /tmp/agents.json)
|
||||
vision=$(jq -r --arg a "$name" '.[$a].vision' /tmp/agents.json)
|
||||
|
||||
Reference in New Issue
Block a user