ci: make the Pi workflow reusable across the forge #3
No reviewers
Labels
No labels
dependencies
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
alex/.profile!3
Loading…
Reference in a new issue
No description provided.
Delete branch "pi-reusable-workflow"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Turns
alex/.profile/.forgejo/workflows/pi.ymlinto a reusable workflow so every repo in the forge can invoke the same Pi definition instead of duplicating it.Closes the request in #1: "can we have a single reusable Pi workflow and just refer to it from other workflows in this forge?"
Why
Today any repo that wants Pi must copy the whole workflow — action reference, model/provider wiring, the who-may-invoke guard, the token config — and the copies drift apart. Forgejo 15 supports the standard
workflow_callreusable-workflow pattern, so we can have one source of truth and let other repos delegate with a 4-line wrapper.Changes
.forgejo/workflows/pi.yml— added theworkflow_calltrigger (keptissue_commenttoo, so.profileis its own consumer and needs no wrapper). No change to behaviour for this repo.docs/examples/pi.yml— ready-to-copy drop-in wrapper for any other repo:uses: alex/.profile/.forgejo/workflows/pi.yml@main+secrets: inherit.docs/reusable-pi-workflow.md— full guide: the wrapper, how event/github.repository/secrets/varspropagate through a called workflow, why each repo still needs a tiny file (per-repoissue_commentdispatch), and how this dovetails with thepibot identity (PI_TOKENbecomes a one-line edit that applies forge-wide).How other repos consume it
When
/pi …is commented in that repo, the wrapper fires, the comment event is propagated into the called workflow (so theifguard andgithub.event.commentstill work),actions/checkoutchecks out that repo (github.repository= the caller), and owner-level secrets/vars (LLM_API_KEY,MODEL, …) are inherited.Notes / trade-offs
issue_commentper repo, so one workflow can't auto-run across all of them. The reusable pattern centralises the logic; each repo only carries the delegating wrapper — strictly better than copying the full file.env.FORGEJO_TOKEN) to avoid breaking the working setup. OncePI_TOKENexists (perdocs/setup-pi-bot.md), flippinggithub_tokenin this one file makes every consuming repo post as@pi— which is the main payoff of combining this with #1.ifguard.