Skip to content

[#850 A] Automated standards-deploy driver (scheduled fleet sweep → standards-sync PRs) #851

Closed

Description

@don-petry

Part of Epic #850. Blocked by #849 (so it deploys correct major-scoped channel pins, not bare tags).

Problem

scripts/deploy-standard-workflows.sh is the fleet's shim deployer but runs only manually — standards-deploy-tests.yml merely tests it, and the compliance audit only files remediation issues, never deploys. So bringing the fleet to standard requires a human running the script (and today, admin-merging the PRs). There is no automation that places/re-pins shims.

Scope

Add a scheduled + workflow_dispatch workflow (e.g. standards-deploy.yml) on petry-projects/.github that runs deploy-standard-workflows.sh across the fleet on the org cadence, opening standards-sync PRs wherever a repo drifts (missing required shim OR pinned off its agent's current v<M>-stable channel).

  • Reuse the existing script and standards-sync label — no new deploy logic; this is a driver, not a reimplementation.
  • Idempotent: SKIP … already compliant repos open nothing (proven behavior).
  • Respect SKIP_REPOS / SKIP_OVERRIDES.
  • Sensible cadence (e.g. weekly, offset from the compliance audit) + a dispatch for on-demand.
  • Uses the org PAT already wired for cross-repo PR creation; least-privilege.

Acceptance

Activity

  1. don-petry commented on Jul 21, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead Implementation Plan

    Issue: #851 — [#850 A] Automated standards-deploy driver (scheduled fleet sweep → standards-sync PRs)

    Scope

    Add a scheduled + workflow_dispatch driver that runs the existing deploy-standard-workflows.sh across the fleet on the org cadence — opening standards-sync PRs only for drifted repos — plus a thin env→flags driver script so the dispatch inputs are unit-testable. No new deploy logic; drift detection, SKIP_REPOS, ring pinning, and PR creation all stay in the existing script/libs.

    Implementation Checklist

    • scripts/standards-deploy-driver.sh — thin driver mapping env inputs (TARGET_REPO, TARGET_WORKFLOW, DRY_RUN) to deploy-standard-workflows.sh flags and exec-ing it
    • .github/workflows/standards-deploy.yml — weekly cron (Mon 08:00 UTC, offset from the Fri 12:00 UTC compliance audit) + workflow_dispatch (target_repo / target_workflow / dry_run); ORG_SCORECARD_TOKEN; least-privilege (permissions: {} top-level, contents: read on the job)
    • .github/workflows/standards-deploy-tests.yml — add the driver script to shellcheck, add the new test dir to the bats run, add both new files to path triggers

    Tests to Write

    • test/scripts/standards-deploy-driver/driver.bats — argv mapping (repo/workflow/dry-run → flags, default = whole fleet), drift path (missing stub → plans PR), no-op path (compliant stub → nothing), fleet iteration over gh repo list

    Test Command

    bats test/scripts/standards-deploy-driver/ test/scripts/deploy-standard-workflows/ and bash .dev-lead/scripts/dev-lead-lint.sh

  2. don-petry commented on Jul 21, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead: Implementation Complete

    Plan Execution

    • scripts/standards-deploy-driver.sh — thin env→flag driver over deploy-standard-workflows.sh (no new deploy logic)
    • .github/workflows/standards-deploy.yml — weekly cron (Mon 08:00 UTC, offset from the Fri 12:00 UTC compliance audit) + workflow_dispatch (target_repo / target_workflow / dry_run)
    • .github/workflows/standards-deploy-tests.yml — driver added to shellcheck + bats run + path triggers
    • test/scripts/standards-deploy-driver/driver.bats — argv mapping, drift, no-op, and fleet-iteration coverage

    Test Results

    $ bats test/scripts/lib/standards-deploy.bats test/scripts/lib/ring-pins.bats \
           test/scripts/deploy-standard-workflows/ test/scripts/standards-deploy-driver/
    ... (55 tests) ...
    ok 50 maps target_repo, target_workflow, and dry_run to script flags
    ok 51 no inputs sweeps the whole fleet (no --repo / --workflow flags)
    ok 52 dry_run defaults off — no --dry-run flag when unset
    ok 53 drift path: a missing stub is planned as a PR
    ok 54 no-op path: a compliant stub opens nothing
    ok 55 fleet sweep iterates every repo from gh repo list
    
    $ shellcheck --severity=warning -x scripts/standards-deploy-driver.sh        # OK
    $ bash .dev-lead/scripts/dev-lead-lint.sh                                     # all checks passed
    $ yamllint (repo CI config) standards-deploy.yml standards-deploy-tests.yml   # PASS
    $ actionlint standards-deploy.yml standards-deploy-tests.yml                  # PASS
    

    Files Changed

    • scripts/standards-deploy-driver.sh (new): maps dispatch inputs (TARGET_REPO, TARGET_WORKFLOW, DRY_RUN) onto the deploy script's --repo / --workflow / --dry-run flags and exec's it. Empty inputs = whole-fleet, all-workflows sweep (the scheduled default). DEPLOY_SCRIPT is overridable for tests.
    • .github/workflows/standards-deploy.yml (new): scheduled + workflow_dispatch driver. Least-privilege — top-level permissions: {}, job-level contents: read (checkout only); all cross-repo branch/PR writes use ORG_SCORECARD_TOKEN.
    • .github/workflows/standards-deploy-tests.yml: added the driver script to shellcheck, the new bats dir to the run, and both new files to the PR/push path triggers.
    • test/scripts/standards-deploy-driver/driver.bats (new): 6 tests — argv mapping (repo/workflow/dry-run + default fleet), drift path (missing stub → plans PR), no-op path (compliant stub → opens nothing), and fleet iteration over gh repo list.

    Notes

    • Reuses the existing script + standards-sync label — the driver adds zero deploy logic. Drift detection, SKIP_REPOS / SKIP_OVERRIDES, ring/channel pinning, idempotency, and PR creation all remain in deploy-standard-workflows.sh and its libs.
    • Token: ORG_SCORECARD_TOKEN is the PAT already wired for cross-repo standards-sync PR creation — compliance-remediate.sh opens its standards-sync PRs via the same sd_deploy_via_pr() primitive under this token. No new secret introduced.
    • Cadence: weekly on Monday, offset from the Friday compliance audit, so the audit's findings age a few days before the deploy sweep acts on them. Dispatch supports on-demand fleet sweeps, single-repo (target_repo), single-workflow, and dry_run.
    • Standard templates pin retiring bare <agent>/stable tags — migrate to major-scoped v<M>-stable channels (#657) #849 dependency: correct major-scoped channel pinning is already handled inside deploy-standard-workflows.sh (emit_ref_for / ring-pins) — this driver inherits it; no pinning logic added here.
    • Pairs with Epic: Fully-automated fleet-wide version+channel shim compliance (no manual deploy / admin-merge) #850-B (auto-merge) to close the sweep → PR → merge loop with zero manual intervention.
  3. don-petry commented on Jul 21, 2026

    @don-petry
    ContributorAuthor

    DAG (Epic #850): Depends on → #849 (correct template pins) + #852 (to auto-merge). Blocks → #857 (E, convergence). Phase 2, parallel with #856.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dev-leadFor dev-lead agent pickup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions