Repository navigation
feat(team): run a team brain's ci workflow on workflow_dispatch too - #43
Merged
Merged
Conversation
A pull request opened by a workflow with GITHUB_TOKEN starts no pull_request run, so a bot pull request such as a pin bump shows no check. With workflow_dispatch the bot can dispatch ci.yml on its branch, and the run's check shows on the pull request. km init --team writes the trigger. km upgrade only moves the pins of a km ci.yml that is not one of the copy-in versions, so it now also adds `workflow_dispatch:` at the end of the `on:` block of a km ci.yml (one that installs pasrom/km) that lacks it, checked by parsing: the result must be the same workflow with exactly that trigger added, otherwise the file stays as it is and upgrade says to add it by hand.
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A pull request that a workflow opens with
GITHUB_TOKENstarts nopull_requestrun, so a bot pull request (a pin bump) shows no check.workflow_dispatchis the one triggerGITHUB_TOKENmay start: with it, the bot dispatchesci.ymlon its branch, and the run's check shows on the pull request's head commit.What changes
templates/team/ci.ymlgetsworkflow_dispatch:underon:, with a comment saying why. A dispatched run does not serve:km serveand the upload stay gated onpush.km upgrade: it rewritesci.ymlonly when the file is one of the copy-in versions (OLD_COPIESfingerprints), and a 1.xci.ymlnever matches them, since its pin line differs per brain. Every other kmci.ymlonly had its pin moved, so the trigger would never reach an existing brain. Smallest change: for a team brain whoseci.ymlpins km (read_pins),with_dispatch()addsworkflow_dispatch:at the end of theon:block, at the block's indent. The result must parse to the same workflow with exactly that trigger added, otherwise nothing is written and upgrade says to add it by hand (a one-lineon: [push, pull_request], say). A workflow that already has the trigger, in any form, is left as it is. Aci.ymlthat does not install km is not touched.Tests (team_smoke.sh)
init writes the trigger; a copied-in
ci.ymlis rewritten with it; upgrade adds it to a kmci.ymlwithout it and changes nothing else (parsed before and after); a second upgrade changes nothing; a comment naming the trigger does not count as the trigger; anon:block at the end of a file without a final newline; a one-lineon:gets the hand-edit note and no write; a team brain'sci.ymlthat does not install km gets no trigger. Each was checked to fail without its part of the change (template, the upgrade step, theci in pinsguard, the final-newline handling).Reviews
/simplify, applied: one parse helper instead of two try blocks; reuseread_pinsto decide thatci.ymlis km's instead of a second read and substring test; decide "has the trigger" from the parsedon:instead of a substring, so a comment does not count. Not applied: share a block scanner withwith_team_hooksininit.py. That one walks a YAML list of repo entries (top-level-and comment lines inside the block), this one a mapping; a shared helper would carry both cases for about ten lines saved./code-review, applied: theci.ymlkey compared with a forward-slash literal whileread_pinskeys use the OS separator, so on Windows upgrade never added the trigger (now built withPath); the test for a brain's ownci.ymlcould not fail (now a team brain whoseci.ymlhas anon:block but no km pin); the final-newline case. Not applied:ci.ymlthat also pins km gets the trigger. It is the same signal upgrade already uses for "a team brain", the edit adds one trigger and nothing else, and upgrade prints it.ci.yamlis not looked at: km writesci.yml.mainbuilds no served bundle: the gate keeps meaning "push to main"; a dispatch is for checks.ci.yml: brains get* text=auto eol=lf.All smoke tests pass locally. No change under
skills/km/, so the plugin evals do not apply.