fix: guard legacy iOS delivery refs - #164
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a secretless, reusable GitHub Actions guard to ensure legacy iOS beta/release deliveries only proceed when the workflow event is bound to an immutable, trusted ref (protected main head for manual dispatches, semantic vX.Y.Z tags for published releases), before entering the release Environment.
Changes:
- Introduces a reusable
legacy-delivery-ref.ymlworkflow that validatesgithub.ref/github.sha, protected-mainhead, and semantic release tag refs, and outputs an immutable SHA for checkout. - Updates
beta.ymlandrelease.ymlto requireexpected_sha, run the validation job first, and check out only the validated SHA in the Environment-bearing job. - Adds Node-based YAML contract tests for workflow structure and behavior, plus supporting docs and tooling deps.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/legacy-delivery-workflows.test.ts | Adds contract tests that parse workflows and assert the validation-before-environment and immutable-checkout guarantees. |
| package.json | Adds yaml devDependency to support workflow contract parsing in Node tests. |
| pnpm-lock.yaml | Locks the new yaml@2.9.0 dependency. |
| docs/DISTRIBUTION.md | Updates distribution docs to describe the new protected-main SHA guard and immutable checkout behavior. |
| .github/workflows/beta.yml | Adds expected_sha input and gates the release Environment job behind the reusable validation job and validated checkout SHA. |
| .github/workflows/release.yml | Adds expected_sha input, validates refs before Environment access, and checks out the validated SHA for both manual and published-release flows. |
| .github/workflows/legacy-delivery-ref.yml | New reusable, secretless validation workflow producing an immutable SHA output for downstream jobs. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (1)
.github/workflows/release.yml:35
release.ymlis triggered by bothreleaseandworkflow_dispatch. Referencinginputs.expected_shadirectly can be undefined forrelease-triggered runs, which would break the guard invocation. Use a defensive fallback so published releases pass an empty string forexpected_sha.
expected_sha: ${{ inputs.expected_sha }}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reviewer Guide
.github/workflows/legacy-delivery-ref.ymlVisual Aids
N/A
Changed
mainSHAmainhead before entering thereleaseEnvironmentreleaseEnvironment jobsGITHUB_ENVRisks
main; otherwise same-path directmaindispatches would bypass the default-branch relaymainmovement between relay resolution and workflow creation fails closed before Environment accessValidation
mise run verifypnpm exec tsc --noEmitnode --test 'scripts/**/*.test.ts'actionlintpnpm install --frozen-lockfilemise run run-simulator— not applicable; auth, keychain, and signed-in persistence are unchangedSanity Checks
maindispatch requiresexpected_shato equal the workflow event SHA and current protectedmainheadvX.Y.Ztag refscontents: readonly and no Environment, secrets, checkout, or signing accessenvironment: releaseand check out only the validated SHAComplexity
One reusable secretless guard is shared by the existing beta and release workflows. Delivery policy remains in those workflows; this PR adds no parallel signing or publishing implementation.
Benchmarks
N/A
Notes
The user-facing default-branch workflows and relay are in #163. Post-merge acceptance must confirm workflow registration and perform a deliberately authorized beta dispatch separately; this work does not dispatch, sign, upload, or publish anything.