ci(nightly): enable automated 04:00 UTC schedule and Stage 2 signer dispatch (#4867)

This commit is contained in:
Dylan M. Taylor
2026-11-29 19:15:24 -05:00
committed by GitHub
parent e4b6735818
commit f53a9b0627
4 changed files with 35 additions and 17 deletions
+3 -1
View File
@@ -83,7 +83,9 @@
}
},
"max_artifact_bytes": 2147483648,
"automatic_signer_actors": [],
"automatic_signer_actors": [
"github-actions[bot]"
],
"platforms": {
"windows-x86_64": {
"unsigned_artifact_name": "nightly-unsigned-windows-x86_64",
+2 -2
View File
@@ -11,9 +11,9 @@ permissions: {}
jobs:
dispatch:
# SOURCE PREPARATION: literal off until immutable shared tooling and policy qualification.
# Transport guard only; the protected signer-branch validator enforces full admission.
if: >-
false && github.repository == 'storytold/lightcraft' &&
github.repository == 'storytold/lightcraft' &&
github.event_name == 'workflow_run'
runs-on: ubuntu-latest
timeout-minutes: 5
+3 -2
View File
@@ -1,8 +1,9 @@
name: LightCraft unsigned nightly
# Enabled for supervised manual runs by the reviewed manual actor only; no schedule yet.
# A later explicit opt-in may add a cadence (and turn on nightly-dispatch.yml with it).
# Runs automatically on the reviewed daily schedule (04:00 UTC) and on supervised manual dispatch.
on:
schedule:
- cron: '0 4 * * *'
workflow_dispatch:
permissions:
+27 -12
View File
@@ -207,15 +207,22 @@ class TrustedSourcePreparation(unittest.TestCase):
(indicator, expression), = job_conditions(jobs)
self.assertFalse(indicator == ">-" and " ".join(expression.split()) == expected)
def test_no_nightly_schedule_is_registered(self):
for name, event in (("nightly.yml", "workflow_dispatch"),
("nightly-sign.yml", "workflow_dispatch")):
source = (ROOT / ".github/workflows" / name).read_text()
events = source.split("\non:\n", 1)[1].split("\npermissions:", 1)[0]
triggers = [line for line in events.splitlines() if line.startswith(" ")
and not line.startswith(" ") and line.strip() and not line.lstrip().startswith("#")]
with self.subTest(workflow=name):
self.assertEqual(triggers, [f" {event}:"], "schedule/activation needs explicit review")
def test_nightly_schedule_is_reviewed_and_signer_stays_dispatch_only(self):
producer = (ROOT / ".github/workflows/nightly.yml").read_text()
producer_events = producer.split("\non:\n", 1)[1].split("\npermissions:", 1)[0]
producer_triggers = [line for line in producer_events.splitlines() if line.startswith(" ")
and not line.startswith(" ") and line.strip() and not line.lstrip().startswith("#")]
self.assertEqual(producer_triggers, [" schedule:", " workflow_dispatch:"],
"producer triggers must stay limited to the reviewed schedule and manual dispatch")
self.assertEqual(re.findall(r"(?m)^ - cron: '([^']+)'$", producer_events), ["0 4 * * *"],
"producer schedule must match the reviewed 04:00 UTC cadence")
signer = (ROOT / ".github/workflows/nightly-sign.yml").read_text()
signer_events = signer.split("\non:\n", 1)[1].split("\npermissions:", 1)[0]
signer_triggers = [line for line in signer_events.splitlines() if line.startswith(" ")
and not line.startswith(" ") and line.strip() and not line.lstrip().startswith("#")]
self.assertEqual(signer_triggers, [" workflow_dispatch:"],
"signer must stay workflow_dispatch-only")
def test_signer_serialization_contract_is_enforced(self):
assert_nightly_serialization((ROOT / ".github/workflows/nightly-sign.yml").read_text())
@@ -350,7 +357,8 @@ class NightlyEnabledCallers(unittest.TestCase):
source = (ROOT / ".github/workflows/nightly.yml").read_text()
policy = json.loads(INSTALLED_POLICY.read_text())
self.assertEqual(reviewed_manual_actors(source, policy), RELEASE_MANAGERS)
self.assertEqual(policy["automatic_signer_actors"], [], "no automatic signer without a schedule")
self.assertEqual(policy["automatic_signer_actors"], ["github-actions[bot]"],
"automatic signer actor must stay limited to github-actions[bot]")
def test_an_actor_outside_the_release_managers_is_refused(self):
source = (ROOT / ".github/workflows/nightly.yml").read_text()
@@ -812,13 +820,20 @@ class NightlySignerBranchTrustClosure(unittest.TestCase):
self.assertNotIn("refs/heads/release", sign, "the signer no longer runs on the stable branch")
self.assertEqual(re.findall(r"(?m)^ app-name: (\S+)$", sign), ["lightcraft"],
"the shared signer needs the reviewed registry app")
producer = (ROOT / ".github/workflows/nightly.yml").read_text()
(producer_name,) = re.findall(r"(?m)^name: (.+)$", producer)
dispatch = (ROOT / ".github/workflows/nightly-dispatch.yml").read_text()
self.assertIn(f"workflows: [{producer_name}]", dispatch,
"dispatch transport must match the producer workflow name")
self.assertEqual(re.findall(r"'ref': '([^']+)'", dispatch), ["refs/heads/" + SIGNER_BRANCH])
(_, guard), = job_conditions(dispatch.split("\njobs:\n", 1)[1])
self.assertTrue(guard.startswith("false && "), "transport stays literally off until a schedule is approved")
self.assertEqual(" ".join(guard.split()),
"github.repository == 'storytold/lightcraft' && github.event_name == 'workflow_run'",
"dispatch transport stays gated to this repository's workflow_run events")
policy = json.loads(INSTALLED_POLICY.read_text())
self.assertEqual(policy["release_branch"], SIGNER_BRANCH)
self.assertEqual(policy["automatic_signer_actors"], [], "no automatic signer without a schedule")
self.assertEqual(policy["automatic_signer_actors"], ["github-actions[bot]"],
"automatic signer actor must stay limited to github-actions[bot]")
if __name__ == "__main__":