Skip to content

feat(ci): workflow_dispatch + --force, rewire dead dispatches#73

Merged
phramz merged 1 commit into
mainfrom
feat/ci-workflow-dispatch
Apr 24, 2026
Merged

feat(ci): workflow_dispatch + --force, rewire dead dispatches#73
phramz merged 1 commit into
mainfrom
feat/ci-workflow-dispatch

Conversation

@phramz

@phramz phramz commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Option B of the post-unification cleanup. Two intertwined changes:

1. ci.yml gets an on-demand rebuild surface

  • New workflow_dispatch trigger with a force: boolean input (defaults to false).
  • pipeline cells thread inputs.force into make ci-cell via a new FORCE env var.
  • internal/build: phpup build php|ext|cell learns a --force flag. When set, the spec-hash LookupBySpec cache-probe is skipped, so every bundle is rebuilt from source even when a matching artifact is already in the target registry.
  • New unit test: TestBuildPHP_Force_BypassesCacheHit seeds a layout with an identically-spec-hashed bundle, asserts --force still invokes the runner.

2. Rewire the dead dispatch glue that PR #60 left behind

  • security-rebuild.yml previously referenced ./.github/workflows/plan-and-build.yml, which PR feat(ci): cut over to unified ci.yml, delete legacy workflows (PR 5/6) #60 deleted. Any dispatch failed at parse-time. Now it calls actions.createWorkflowDispatch({workflow_id: 'ci.yml', inputs: { force: 'true' }}) via actions/github-script@v7. Keeps the repository_dispatch: [security-rebuild] entry point.
  • watch-php-releases.yml + watch-runner-images.yml used to fire peter-evans/repository-dispatch@v4 events (php-release-detected, runner-image-updated) that no workflow was listening for. Both now dispatch ci.yml with force: false — the .state/ commit is still the canonical observer signal, and a routine re-run of ci.yml on the latest main surfaces any drift without doing the expensive full-rebuild that force: true implies.

Force ergonomics, split intentionally

Trigger force Behavior
push to main (normal merge) n/a Spec-hash probe short-circuits unchanged cells
pull_request n/a Same — cache-probe honored
Scheduled watch-*.ymlci.yml false Re-run over latest main; reuse unchanged artifacts
repository_dispatchsecurity-rebuild.ymlci.yml true Full rebuild, e.g. after a system-lib CVE
Manual gh workflow run ci.yml -f force=true operator's choice Same as security-rebuild

Test plan

  • make check green locally (15 Node tests + 21 Go packages pass, new --force test exercises the new branch)
  • CI green on this PR (the workflow_dispatch addition is a trigger-surface change, not a behavior change for PRs/pushes — existing matrix should still be fully green)
  • After merge: gh workflow run ci.yml -f force=true --ref main shows up in Actions UI with the new force toggle; confirm the pipeline logs show phpup build php: --force, skipping cache-probe on each cell.
  • Trigger security-rebuild via gh api repos/buildrush/setup-php/dispatches -f event_type=security-rebuild after merge; confirm it spawns a ci.yml run with inputs.force = true.

Sequenced before Option A (action-surface smoke test) per the design plan — keeps main's scheduled-rebuild posture alive while A lands.

Adds an on-demand rebuild surface to ci.yml and rewires the stale
dispatch glue that PR #60 (legacy workflow cutover) left hanging.

ci.yml
  - New `workflow_dispatch` trigger with a `force: boolean` input.
    Defaults to false; a force=true dispatch skips the spec-hash
    cache-probe in every pipeline cell so security-class rebuilds
    produce fresh artifacts even when the inputs are unchanged.
  - `pipeline` cell threads `inputs.force` into `make ci-cell`
    via a FORCE env var so the downstream phpup gets --force.

internal/build + Makefile
  - phpOpts / extOpts / cellOpts grow a Force field; each parse*
    FlagSet exposes --force.
  - BuildPHP and BuildExt bypass the LookupBySpec cache-probe when
    opts.Force is set, printing a "--force, skipping cache-probe"
    note so the pipeline log is obvious about why the build ran.
  - BuildCell forwards --force to both downstream BuildPHP and each
    BuildExt so a cell invocation does the right thing end-to-end.
  - `make ci-cell FORCE=1` threads through to the CLI.
  - Unit test: TestBuildPHP_Force_BypassesCacheHit seeds a layout
    with an identically-spec-hashed bundle, invokes BuildPHP with
    --force, asserts the runner was called and no "cache hit" line
    hit stdout. Closes the gap that the plain cache-hit test left.

security-rebuild.yml
  - Pre-existing: `uses: ./.github/workflows/plan-and-build.yml` —
    but that file was deleted in PR #60, so any dispatch failed at
    parse-time. Replaced with a single actions/github-script@v7
    step that calls actions.createWorkflowDispatch against ci.yml
    with force=true. Preserves the `repository_dispatch: [security-
    rebuild]` public entry point.

watch-*.yml
  - Both workflows previously emitted peter-evans/repository-dispatch
    events (`php-release-detected`, `runner-image-updated`) that no
    workflow listened for — a silent no-op. Swap both steps to
    actions/github-script workflow_dispatch calls against ci.yml
    (force=false — a new upstream signal doesn't by itself
    invalidate existing bundles; catalog updates land separately).
  - watch-runner-images.yml also pulls the github token out of the
    run: block into an env var to quiet the workflow-injection
    pre-commit guard.

The force ergonomics split intentionally:
  - routine main push + nightly observer poll: no force; pipeline
    short-circuits unchanged cells via the existing spec-hash probe.
  - manual "gh workflow run ci.yml -f force=true" + security-rebuild
    dispatch: force=true rebuilds everything.

Verification: make check green; 15/15 Node tests; all 21 Go packages
pass. The new TestBuildPHP_Force_BypassesCacheHit fails as expected
if the --force conditional is reverted to the old unconditional
cache-probe, and passes with the new branch.
@phramz
phramz merged commit 78da074 into main Apr 24, 2026
24 checks passed
@phramz
phramz deleted the feat/ci-workflow-dispatch branch April 24, 2026 12:37
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.

1 participant