Skip to content

fix(ops): keep the public deploy lane green until the Pages token is provisioned - #85

Closed
nish3451 wants to merge 2 commits into
mainfrom
fix/lane1-deploy-lane-dormant-until-pages-token
Closed

fix(ops): keep the public deploy lane green until the Pages token is provisioned#85
nish3451 wants to merge 2 commits into
mainfrom
fix/lane1-deploy-lane-dormant-until-pages-token

Conversation

@nish3451

Copy link
Copy Markdown
Collaborator

Why

The tinystudio.in release lane (from PR #70, landed via #81) is fail-closed on the CLOUDFLARE_API_TOKEN secret. That secret does not exist — the repo currently has zero secrets (gh api .../actions/secrets → total_count 0) — so every push to main produces a permanently red Deploy public site run:

  • b2a58e0: Deploy public site → failure (missing CLOUDFLARE_API_TOKEN)
  • 45ef63b: Deploy public site → failure

A lane that can never pass is worse than no lane: the red run is indistinguishable from a real deploy failure, and it drowns the signal the lane exists to provide.

What

Gate the publish step on the secrets actually existing. Step-level if is used because the secrets context is not available at job level:

  • While absent: the publish step is skipped and a notice step prints the exact one-time provisioning steps (Cloudflare dashboard → Pages:Edit token scoped to account f670a698e17bf160c8e4679823e68916gh secret set ×2). The lane is visibly dormant, never red.
  • Still runs every merge: the pre-deploy repository gate (npm run check) and the filtered bundle prepare step, so the lane stays warm and the bundle stays regression-guarded.
  • Once provisioned: the very next main merge publishes automatically, and any deploy/verify failure fails the run loudly — fail-closed semantics are preserved exactly when they matter.

The publish script (scripts/publish-public-site.mjs) is unchanged: direct/manual runs without a token still print the provisioning message and exit non-zero.

Verify

  • yaml parse: python3 -c 'import yaml; yaml.safe_load(open(...))' → ok
  • node scripts/test-public-deploy-bundle.mjs → passes
  • git diff --check → clean
  • Post-merge: next main push should show Deploy public site with the publish step skipped and the notice annotation instead of a failure.

…provisioned

The release lane (PR #70/#81) is fail-closed on CLOUDFLARE_API_TOKEN,
but the repo has no secrets at all, so every push to main produces a
permanently red 'Deploy public site' run that is indistinguishable from
a real deploy failure.

Gate the publish step on the secrets actually existing (step-level if,
where the secrets context is available): while absent, the step is
skipped and a notice step prints the exact provisioning steps, keeping
the lane visibly dormant; the pre-deploy and bundle-prepare gates still
run on every merge. The moment both secrets exist the lane publishes
and fails loudly on any deploy/verify error, preserving fail-closed
behavior once provisioned. Direct manual runs of publish-public-site.mjs
remain fail-closed (the script is unchanged).

verify: yaml syntax parse; git diff --check

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nish3451 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@nish3451, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 6 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d096161-0e34-403d-8939-76aa3b7abcff

📥 Commits

Reviewing files that changed from the base of the PR and between d898707 and 26ca2ae.

📒 Files selected for processing (1)
  • .github/workflows/deploy-public-site.yml

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 758eead1c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

run: node scripts/publish-public-site.mjs --prepare-only --output "$RUNNER_TEMP/tinystudio-public-bundle"

- name: Publish to Cloudflare Pages and verify live
if: ${{ secrets.CLOUDFLARE_API_TOKEN != '' && secrets.CLOUDFLARE_ACCOUNT_ID != '' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Move secret checks through job-level environment variables

On every push or manual dispatch, GitHub rejects this step condition because the secrets context is unavailable in jobs.<job_id>.steps.if; the dormant notice uses the same unsupported context, so this change makes the release workflow fail validation rather than keeping it green. GitHub's workflow syntax documentation explicitly says secrets cannot be referenced directly in if: conditionals and recommends assigning them to job-level environment variables before testing env.* instead.

Useful? React with 👍 / 👎.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nish3451 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

nish3451 added a commit that referenced this pull request Aug 12, 2026
…very main merge while the Pages token is missing (#111)

The deploy lane has been failing every main push since PR #81 landed:
without CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID the publish step
throws after a full npm ci + check + prepare cycle (~6 minutes), leaving
the live site permanently stale on the June-20 bundle.

PR #85 attempted to gate the publish step on the secrets, but its
step-level `if: ${{ secrets... != '' }}` conditions are invalid - the
secrets context is not available in step-level if conditions (context
availability table), so the workflow failed validation and never ran.

Hoist both secrets into the job-level env (where the secrets context is
allowed) and gate every expensive step with `if: env.X != ''`:
- Dormant (no secrets): seconds-long green run printing the exact
  one-time provisioning steps as a warning annotation.
- Active (both secrets set): unchanged fail-closed publish + live
  verification on every main merge; the moment the token is provisioned
  the lane deploys without any code change.
@nish3451

Copy link
Copy Markdown
Collaborator Author

Closing — main has since solved this, deliberately choosing the opposite behaviour, and this branch also has a latent bug.

1. main made the opposite call on purpose. The deploy lane on main now fails loudly when the Pages secrets are missing, with the comment: a skipped publish must never show a green deploy status. This PR makes the lane skip and stay green instead. That is a direct policy reversal, not a gap to fill.

2. The condition here would not work. This PR gates the publish step with if: ${{ secrets.CLOUDFLARE_API_TOKEN != '' && ... }}. The secrets context is not available in step-level if: conditions, so that expression evaluates against an empty value and the publish step would never run — even after the token is provisioned. main already handles this correctly by hoisting both secrets into the job-level env: and testing env.CLOUDFLARE_API_TOKEN == '', with a comment explaining exactly this pitfall.

3. The provisioning guidance already landed. main's failure step prints the same one-time dashboard steps this PR wanted to add.

Separately, and worth flagging: CLOUDFLARE_ACCOUNT_ID is set in repo secrets but CLOUDFLARE_API_TOKEN still is not, so the deploy lane is still red. Provisioning that token is a Nish-only step and is not something this sweep can or should do.

@nish3451 nish3451 closed this Aug 19, 2026
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