Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d803ee7cf5 | ||
|
|
1d248bc675 | ||
|
|
1fd32f0ff6 | ||
|
|
e9fad6bfad | ||
|
|
729a14f8bd | ||
|
|
d3c8f116f1 | ||
|
|
658c10fc35 |
@@ -1,6 +1,9 @@
|
||||
name: ai-agent
|
||||
# Thin caller so the agents work on THIS repo too (their own workflow). Same shared logic.
|
||||
# New issues opened by ffaerber auto-start @pm; @mention an agent in a comment to route on replies.
|
||||
run-name: "ai-agent · #${{ github.event.issue.number }}" # quotes required: bare # starts a YAML comment
|
||||
# Standard caller for the shared AI-agent workflow (ffaerber/agents). Copy this file VERBATIM into
|
||||
# any repo that should get the agents — it is identical in every repo. All logic + scripts live in
|
||||
# agents/.gitea/workflows/; scripts are fetched from @main at run time. The `jobs.agent` wrapper is
|
||||
# required: a reusable (workflow_call) workflow can only be invoked from a caller job, not top-level.
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
@@ -55,7 +55,13 @@ if [ -n "$IS_PR" ]; then # comment on a PR -> resume its bra
|
||||
ref=$(curl -s -H "Authorization: token $GT" "$API/pulls/$NUM" | jq -r .head.ref)
|
||||
git fetch origin "$ref" && git checkout "$ref"
|
||||
{ echo "branch=$ref"; echo "new=false"; } >> "$GITHUB_OUTPUT"
|
||||
else # comment on an issue -> new branch
|
||||
elif git ls-remote --exit-code --heads origin "ai/issue-$NUM" >/dev/null 2>&1; then
|
||||
# comment on an issue whose branch ALREADY exists (a prior run / open PR) -> RESUME it, so new
|
||||
# commits fast-forward onto the same branch and update its PR. Branching fresh from main here would
|
||||
# be rejected on push as non-fast-forward and the new work would be silently lost (see issue #17).
|
||||
git fetch origin "ai/issue-$NUM" && git checkout "ai/issue-$NUM"
|
||||
{ echo "branch=ai/issue-$NUM"; echo "new=false"; } >> "$GITHUB_OUTPUT"
|
||||
else # comment on an issue, no branch yet -> new branch
|
||||
git checkout -b "ai/issue-$NUM"
|
||||
{ echo "branch=ai/issue-$NUM"; echo "new=true"; } >> "$GITHUB_OUTPUT"
|
||||
# For dev agents, publish the branch immediately and tell the maintainer where to watch.
|
||||
|
||||
@@ -29,10 +29,18 @@ detail out of agents that shouldn't act on it while still letting them know the
|
||||
|
||||
## Use it in a repo
|
||||
|
||||
Add `.gitea/workflows/ai-agent.yml` to the consuming repo:
|
||||
**The standard caller is one file, identical in every repo.** Copy this repo's own
|
||||
[`.gitea/workflows/ai-agent.yml`](.gitea/workflows/ai-agent.yml) verbatim into the consuming repo —
|
||||
it is the source of truth, and `agents` itself uses the same file:
|
||||
|
||||
```yaml
|
||||
name: ai-agent
|
||||
run-name: "ai-agent · #${{ github.event.issue.number }}" # quotes required: bare # starts a YAML comment
|
||||
# Standard caller for the shared AI-agent workflow (ffaerber/agents). Copy this file VERBATIM into
|
||||
# any repo that should get the agents — it is identical in every repo. All logic + scripts live in
|
||||
# agents/.gitea/workflows/; scripts are fetched from @main at run time. The `jobs.agent` wrapper is
|
||||
# required: a reusable (workflow_call) workflow can only be invoked from a caller job, not top-level.
|
||||
# `run-name` titles each run by the triggering issue (e.g. "ai-agent · #42") in the Actions list.
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
@@ -44,7 +52,9 @@ jobs:
|
||||
secrets: inherit
|
||||
```
|
||||
|
||||
That's the whole per-repo footprint. All the logic (agent registry, routing, delegation,
|
||||
That's the whole per-repo footprint, and it's the minimum a caller can be: the `on:` triggers must
|
||||
live in each repo (a reusable workflow can't declare its callers' triggers) and the `jobs.agent`
|
||||
wrapper is mandatory for `workflow_call`. Everything else (agent registry, routing, delegation,
|
||||
reactions, PR/issue plumbing) lives here in `agent.yml`.
|
||||
|
||||
## Repo layout
|
||||
|
||||
Reference in New Issue
Block a user