ci: fix scheduled-build permissions and expose workflow_dispatch inputs#274
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe scheduled GitHub Actions workflow ChangesScheduled build — dispatch, permissions, and wiring
Sequence DiagramsequenceDiagram
autonumber
participant Developer as Developer
participant GitHub as GitHub Actions
participant Reusable as build.yml (reusable)
participant Jobs as nightly job
Developer->>GitHub: trigger workflow_dispatch (inputs: ref, skip_code_scans, skip_linkcheck)
GitHub->>GitHub: evaluate github.event_name (schedule vs dispatch)
GitHub->>Jobs: set job-level permissions (contents/packages/attestations/id-token/etc.)
GitHub->>Reusable: call reusable workflow with computed `with` inputs
Reusable->>Jobs: run steps honoring skip flags
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
The reusable build.yml workflow's nested jobs request actions: read, security-events: write, packages: write, attestations: write, and id-token: write. When called from scheduled-build.yml without an explicit permissions block on the caller job, the caller granted none of these and GitHub rejected the workflow as invalid. Declare the union of required permissions on the nightly job so the reusable workflow can run. Also allow ref, skip_code_scans, and skip_linkcheck to be overridden when the workflow is run manually via workflow_dispatch. Scheduled runs continue to use the previous hardcoded values (ref=develop, skip_code_scans=true, skip_linkcheck=true). For the boolean inputs, use `github.event_name == 'schedule' || inputs.X` so scheduled runs always pass true while dispatch runs honor the user's selection (the simpler `|| true` fallback would clobber a user-supplied false because false is falsy in expressions).
327dc1a to
ba60441
Compare
Summary
actions: read,contents: write,security-events: write,packages: write,attestations: write,id-token: write) on thenightlycaller job so the reusablebuild.ymlcan run. Without this, GitHub rejected the workflow because the called jobs request more permissions than the caller granted.ref,skip_code_scans, andskip_linkcheckasworkflow_dispatchinputs so manual runs can override them. Scheduled runs keep the existing hardcoded behavior (develop, both skips true) via agithub.event_name == 'schedule' || inputs.Xguard that avoids the falsy-default trap of|| true.Targets
mainbecause scheduled workflows only fire from the default branch. Mirrors the equivalent fix inmetaschema-framework/metaschema-java#722.Test plan
workflow_dispatchand confirm it starts cleanlyworkflow_dispatchinputs are visible and overridable from the Actions UISummary by CodeRabbit
New Features
Chores