Skip to content

ci(workflows): share setup, test, image, and deploy [FACT-1885] - #1

Closed
Echobob wants to merge 2 commits into
mainfrom
card/fact-1885
Closed

Echobob wants to merge 2 commits into
mainfrom
card/fact-1885

Conversation

@Echobob

@Echobob Echobob commented Nov 13, 2026 •

Copy link
Copy Markdown

Deploy order

  1. This PR first. v1 already points at this branch's head (228cab2, a README-only commit on top of the reviewed 09a107b), so every caller below already runs the code this PR merges.
  2. Then the callers, in any order. Each is based on its own default branch, not on this one:
  3. If this merges as a squash, move v1 to the resulting commit on main (same tree).

Why

Every repository was carrying its own copy of setup, test, image build, Coolify deploy, and the pull request body check, so a fix had to land once per repository.

What changed

Net source lines vs main: +636 (tests excluded; +636/-0). This is a new repository, so nothing here could be removed. The copies it replaces are deleted in the caller PRs (crm -9, frontdesk -59, factory -2 net), and each later consumer deletes its own.

This repository now holds those reusable workflows and the setup action, pinned by the v1 tag. A job that calls one runs in the caller, so minutes and logs stay on the caller. Coolify deploy reads secrets from Infisical with GitHub OIDC. On macOS the setup action selects arm64 Node.

The README now lists the token permissions each workflow needs from its caller. Our repositories default to a read-only token, and a called workflow can only lower the caller's permissions, so an image.yml caller must grant packages: write and a coolify-deploy.yml caller id-token: write.

What deliberately did NOT change

The organization profile README. No repository secrets are added here. Consumer repositories are updated in their own pull requests, listed above.

What FACT-1885 still needs after this set

The factory and frontdesk Coolify deploys still post with repository secrets. Moving them onto coolify-deploy.yml needs an Infisical machine identity that trusts those repositories over GitHub OIDC, and none exists yet. Creating one is an Infisical admin task. The proposal is on the card.

Verification

  • node --test scripts/pr-guard.test.mjs: # tests 6, # pass 6, # fail 0.
  • actionlint 1.7.7 over .github/workflows/*.yml: no findings.
  • Callers already run on v1: crm run 43368079880 (test.yml@v1), factory run 43377427302 (pr-guard.yml@v1), frontdesk run 43369341612 (setup@v1). All green.
  • Per-repository minutes stay readable after the move. gh api "/organizations/PracticalWorks/settings/billing/usage?year=2026&month=11&day=13" returns one row per repository. On 2026-11-13 it shows crm 12 min, frontdesk 60 min and .github 2 min (Actions Linux). The crm shared-workflow run billed crm; .github holds only its own guard runs.

NEEDS VERIFICATION (after the callers merge): a run in PracticalWorks/crm and one in practical-works-factory both show jobs from PracticalWorks/.github/.github/workflows/...@v1.

Refs: FACT-1885

Made with Cursor

Callers pin the v1 tag, so one tag move reaches every consumer, and each job still runs on the caller's minutes.

Co-authored-by: Cursor <cursoragent@cursor.com>

@practical-bot practical-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

I reviewed origin/main...09a107bcb8c24e340f0e0fa38ba51d1cf85af2a4 and the current PR body. The new shared-workflow implementations are readable and the locally testable guardrail claim is substantiated: node --test scripts/pr-guard.test.mjs passed all 6 tests, and GitHub Actions run 43368070677 ran both guard-tests and guard / check successfully on this exact head (09a107bcb8c24e340f0e0fa38ba51d1cf85af2a4). The setup action selects arm64 on macOS when no architecture is supplied; the image workflow uses the caller's github.token for GHCR; and the deploy workflow requests id-token: write and invokes Infisical's OIDC mode rather than repository secrets.

Findings

  1. The ticket's consumer and Done-when requirements are not met by this change. The PR body says, “Consumer pull requests exercise the tagged workflows,” but this diff contains only files in PracticalWorks/.github and no consumer migration. A fresh GitHub API read shows PracticalWorks/crm still has ci.yml and publish.yml, while PracticalWorks/practical-works-factory still has its own ci.yml, pr-body.yml, and deploy/image workflows; neither repository is changed here to call PracticalWorks/.github/.github/workflows/...@v1. Consequently the required verification run in both consumers cannot exist yet, and the Done-when (“The CRM repo and the factory deploy through the shared workflows, and a one-line change in .github reaches both”) is not demonstrated. Please either land the coordinated consumer migrations before merging this ticket's change or re-scope/split the ticket and link the required consumer PRs; do not treat “consumer pull requests exercise” as evidence that they exist.

  2. The monthly per-repository billing verification is absent. The ticket explicitly requires that organization monthly usage remains readable after the move. No billing check, consumer migration, or evidence for /organizations/<org>/settings/billing/usage?year=&month= appears in this PR. This is a live post-migration check, so it belongs under NEEDS VERIFICATION once the consumer migrations are deployed, but the current PR cannot claim the ticket complete without scheduling and recording it.

Claim ledger

  • “This repository now holds those reusable workflows and the setup action, pinned by the v1 tag.” PASS — the diff adds the reusable workflows/action, and git ls-remote shows refs/tags/v1 resolving to the reviewed commit.
  • “Coolify deploy reads secrets from Infisical with GitHub OIDC.” PASS (static) — .github/workflows/coolify-deploy.yml sets id-token: write and uses Infisical/secrets-action@v1.0.18 with method: oidc; the actual credential exchange remains live-path evidence.
  • “On macOS the setup action selects arm64 Node.” PASS (static) — .github/actions/setup/action.yml selects arm64 when runner.os == 'macOS' and no override is supplied.
  • “No repository secrets are added here.” PASS (diff) — no repository-secret configuration is added; the deploy workflow reads named environment variables populated by Infisical.
  • “Consumer pull requests exercise the tagged workflows.” FAIL / not demonstrated — the diff contains no consumers, and API inspection found no shared-workflow call in the listed CRM/factory workflow trees.
  • “node --test scripts/pr-guard.test.mjs passed, 6 tests.” PASS — exact command exited 0 with 1..6, # tests 6, # pass 6; the exact-head CI run also passed its guard-tests job.

Verification limitations

The Infisical exchange, Coolify webhook, consumer workflow runs, and organization billing page are live checks unavailable from this repository-only review and cannot be inferred from static YAML. The PR is still open at the final state read: gh api repos/PracticalWorks/.github/pulls/1 --jq "[.state,.merged]" returned ['open', false].

REVIEW VERDICT: changes-requested
FINDING: The CRM and factory consumer migrations and the one-line tag propagation are absent from this diff; current API inspection shows both still use local workflows -> HANDLED | FILED FACT-NNN | DROPPED (the required consumer work must be landed or the ticket re-scoped before approval)
FINDING: Per-repository Actions billing readability has no post-migration evidence -> HANDLED | FILED FACT-NNN | DROPPED (needs the consumer migrations and live billing check)
NEEDS VERIFICATION: After consumer migrations merge, run a PracticalWorks/crm workflow and a practical-works-factory workflow and confirm their jobs source PracticalWorks/.github/.github/workflows/...@<tag>; confirm monthly usage remains readable at /organizations/<org>/settings/billing/usage?year=&month=.

@practical-bot

Copy link
Copy Markdown

Review verdict already posted natively for head 09a107bcb8c24e340f0e0fa38ba51d1cf85af2a4: changes requested.

The shared workflows and guard tests are present and the exact test command passed all 6 tests. The blocking gaps remain that CRM and practical-works-factory have not migrated to PracticalWorks/.github/.github/workflows/...@v1, so one-line tag propagation is not demonstrated, and post-migration per-repository billing visibility has not been verified.

REVIEW VERDICT: changes-requested
FINDING: Consumer migrations and one-line tag propagation are absent from this PR.
FINDING: Per-repository Actions billing readability lacks post-migration evidence.
NEEDS VERIFICATION: After migration, verify a CRM run and factory run source the tagged shared workflows and confirm the organization billing usage page remains readable.

A called workflow can only lower the caller's token permissions, and these
repositories default to read-only, so an image.yml caller without
packages: write fails before any step runs. The README now lists what each
workflow needs from its caller, and no longer says image.yml calls the
setup action.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Echobob

Echobob commented Nov 13, 2026

Copy link
Copy Markdown
Author

Pushed 228cab2 and moved v1 to it. Here is each finding, then one I found myself.

1. Consumer migrations are absent from this diff. Agreed that the consumers aren't in this diff. They can't be: a workflow in this repository cannot edit its callers. Each caller has its own PR, and each already runs green on v1:

The body now opens with the deploy order (this PR first, then the callers in any order) and links all three. I am not claiming the Done-when yet. The factory and frontdesk Coolify deploys still use repository secrets. Moving them needs an Infisical machine identity that trusts those repositories over GitHub OIDC, and nobody has created one. That is an Infisical admin task, not code, so I have put it on FACT-1885 for the owner: either split it off behind a human-task card, or hold the card until the identity exists.

2. No per-repository billing evidence. It's readable now, and the shared jobs bill the caller:

gh api "/organizations/PracticalWorks/settings/billing/usage?year=2026&month=11&day=13"
→ .github 2 min · crm 12 min · frontdesk 60 min · newsroom 167 min · … (Actions Linux, one row per repositoryName)

crm's shared test.yml@v1 run shows up under crm. .github holds only its own guard runs. The factory sits in a different org (practical-works-acropolis), which keeps its own billing page.

3. Found while reviewing the callers. A called workflow can only lower the caller's token permissions, and all four repositories default to a read-only token (gh api repos/<repo>/actions/permissions/workflow → "default_workflow_permissions":"read"). frontdesk#475's image job granted nothing, so its first push to main would have failed before the shared build started. No PR check runs ci.yml, so nothing could have caught it. The fix there is b681f3d. The README here now has a "Caller permissions" table (image.yml needs packages: write, coolify-deploy.yml needs id-token: write). It also no longer says image.yml calls the setup action. The commit changes only the README, so moving v1 changed no workflow a caller runs.

Validation on 228cab2: node --test scripts/pr-guard.test.mjs gives # tests 6 / # pass 6 / # fail 0. actionlint 1.7.7 over all workflows reports no findings.

@practical-bot practical-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Scope: delta 09a107b..228cab2.

The only code/document change since the prior verdict is README.md (+13/-1). The permission table and the corrected description of image.yml are useful and technically consistent with the workflows: the image caller needs packages: write, while the deploy caller needs id-token: write. The six guard tests still pass on this tree. The linked CRM and factory runs also show shared-workflow provenance, so the prior “no consumer evidence” finding is now covered by the coordinated caller PRs (though those runs are on their caller heads, not this README commit).

Claim ledger

  • “v1 already points at this branch's head (228cab2...)” FAIL — exact check: git ls-remote origin refs/tags/v1 returned 595ea201d2f2f7b42ef9af1278645a3f30b9cf18e refs/tags/v1, while git rev-parse HEAD returned 228cab2ed6c5ff509992099f6a7c4a36f9bf5136. The tag resolves to neither this head nor the reviewed ancestor (09a107b). The deploy-order claim is therefore stale/false as written; callers pinned to @v1 are not proven to consume the head this PR is intended to release.
  • “node --test scripts/pr-guard.test.mjs: ... # pass 6” PASS — exact command exited 0; output was 1..6, # tests 6, # pass 6, # fail 0.
  • “actionlint 1.7.7 ...: no findings” UNVERIFIED — attempted the stated check, but actionlint is not installed in this review workspace (actionlint_status=UNAVAILABLE). The PR CI rows were both green (guard / check, guard-tests), but neither row reports actionlint.
  • “Callers already run on v1” PASS (provenance only) — gh run view 43368079880 showed PracticalWorks/.github/.github/actions/setup@v1 in the CRM job, and gh run view 43377427302 showed the factory PR guard job. Those runs are successful, but they do not fix the contradictory claim that v1 points to 228cab2.
  • “Per-repository minutes stay readable ... returns one row per repository ... crm 12 min, frontdesk 60 min and .github 2 min” UNVERIFIED in this re-review — the current body quotes a live billing API result, but the exact API command and dated result were not rerun from this review workspace. This is a post-migration live check and remains appropriately scheduled under NEEDS VERIFICATION.

Findings

  1. The updated deploy-order README claims that v1 already points at 228cab2, but the exact remote tag read contradicts it (v1 -> 595ea201..., HEAD 228cab2...). Correct the release/tag evidence and ensure the tag used by callers resolves to the released shared-workflow commit before treating this PR as ready.

The earlier consumer finding is otherwise resolved at the evidence level: the current body links the caller PRs and the CRM/factory run records show @v1 provenance. The README-only delta does not itself migrate callers, so the coordinated caller PRs still need to land in the stated order.

REVIEW VERDICT: changes-requested
FINDING: README claims v1 already points at 228cab2, but git ls-remote origin refs/tags/v1 returned 595ea201... while HEAD is 228cab2...; release/tag evidence is contradictory -> DROPPED (the release owner must correct the tag/order evidence before approval)
NEEDS VERIFICATION: After the coordinated caller migrations merge, run a PracticalWorks/crm workflow and a practical-works-factory workflow and confirm their jobs source PracticalWorks/.github/.github/workflows/...@v1; confirm monthly usage remains readable at /organizations/<org>/settings/billing/usage?year=&month=.

@practical-bot

Copy link
Copy Markdown

@Echobob re-reviewed 228cab2: verdict unchanged (changes-requested).

FINDING: The README-only delta is useful and the prior consumer finding is resolved at the evidence level: CRM run 43368079880 and factory run 43377427302 show shared-workflow provenance. However, the updated README claims v1 already points at 228cab2, while git ls-remote origin refs/tags/v1 returned 595ea201d2f2f7b42ef9af1278645a3f30b9cf18e, not the reviewed head 228cab2ed6c5ff509992099f6a7c4a36f9bf5136. Correct the release/tag evidence before approval.
FINDING: node --test scripts/pr-guard.test.mjs passed all 6 tests. The stated actionlint check is UNVERIFIED because actionlint is unavailable in this review workspace; the two PR checks were green but did not expose an actionlint step.
NEEDS VERIFICATION: After the coordinated caller migrations merge, verify CRM and factory workflow provenance and monthly Actions billing visibility.

@Echobob

Echobob commented Nov 14, 2026

Copy link
Copy Markdown
Author

On the v1 finding ("README claims v1 points to 228cab2, but the remote tag resolves to 595ea201…"): there's no mismatch. v1 is an annotated tag. 595ea201 is the tag object's own SHA, and it peels to commit 228cab2, which is what the README says:

$ git ls-remote --tags https://github.com/PracticalWorks/.github.git | grep 'refs/tags/v1'
595ea201d2f2f7b42ef9af1278645a3f30b9cf18	refs/tags/v1
228cab2ed6c5ff509992099f6a7c4a36f9bf5136	refs/tags/v1^{}
$ gh api repos/PracticalWorks/.github/git/ref/tags/v1 --jq '.object.type + " " + .object.sha'
tag 595ea201d2f2f7b42ef9af1278645a3f30b9cf18

The ^{} line is the commit the tag points to: 228cab2, this PR's head. Callers pinned @v1 resolve to it.

Separately, FACT-1885 has been re-scoped by its owner to the shared workflows plus their first consumers (this PR, crm#2, frontdesk#475, factory#1159). The deploy migration over Infisical OIDC moved to FACT-1910, blocked by the human task FACT-1909. So the "consumer/credential/deploy criteria unmet" finding no longer applies to this card.

@jcotillo

Copy link
Copy Markdown
Contributor

Superseded by #2, which merged this PR's v1 content to main (squash 8e60f60, tagged v1.1.0) plus node setup on self-hosted runners, annotated guard failures, and a Coolify deploy that waits and proves. Every file in this PR is on main. The v1 tag is untouched. Refs: FACT-1885

@jcotillo jcotillo closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants