Skip to content

deploy-cloudflare: support public sites with an explicit visibility input #177

Closed

Description

@quantecon-services

Why

deploy-cloudflare (#163, PR #176) publishes a built site to an existing Cloudflare Worker, but it only supports private sites behind Cloudflare Access. From the name, you would expect it to handle both private and public sites. Right now the only way to deploy a public site is awkward and unsafe:

  • require-access: false skips every gate check. It also prints "Never use this for private content" on every run, and the job summary marks every URL "⚠️ not checked". Nothing verifies what was actually published.
  • team-domain is still required, and must look like <team>.cloudflareaccess.com. A public site has to pass a dummy value.
  • One boolean turns off every check, which makes it too easy to publish a private build by mistake.

The rest of the action already works for a public site: the pinned wrangler, the generated config, the alias, and the job summary.

Proposal

Replace require-access with an explicit declaration that is checked in both directions:

Input Purpose
visibility (required, no default) private or public. Leaving it out, or any other value, fails validation, so every workflow states its audience at the call site and a typo never reads as "off"
team-domain Required when private. An error when public: see the cross-check below
  • private behaves exactly as require-access: true does today. The gate is checked before uploading, after deploying (production and the new version's preview URL), and after the alias upload.
  • public flips the checks instead of skipping them. At the same three points, an anonymous request must be served the site, with no redirect to any *.cloudflareaccess.com. A Worker declared public but actually gated then fails too, so a mix-up between the two fails in either direction.

Updated 2026-09-23: visibility is required with no default, rather than defaulting to private. Intent is then explicit in every workflow: it is as clear to a reviewer as a uses: line, and as searchable (grep 'visibility: public'). Nothing is left implicit for a copied workflow to carry over unnoticed.

Cross-checking the inputs

Validation rejects the combinations that only a workflow copied from the other kind of site would produce:

visibility team-domain Result
private set ✅
private empty ❌ "visibility is private, so team-domain is required"
public empty ✅
public set ❌ "team-domain is set, but visibility is public — did you mean private?"
missing or other any ❌ "visibility must be private or public"

Saying the mode loudly

The first line of the log and the heading of the job summary name the mode:

  • PRIVATE site, gated by <team>.cloudflareaccess.com
  • PUBLIC site, served anonymously

A reader of the run never has to work out which one it was.

Why one action, not two

This was considered: for example deploy-cloudflare for private sites and a separate action for public ones. The config does not make a site public or private; the Worker's Access setting in the Cloudflare dashboard does. The action declares the expected audience and checks the live site against it. Two actions would change where that declaration is written, not what is enforced.

With visibility required, the input carries the same benefit a separate uses: line would: intent is explicit at the call site and searchable across the org. It avoids the costs of splitting:

  • Validation, install, config, deploy, alias and summary would be duplicated, or pulled into shared scripts.
  • A sibling composite call (…/deploy-cloudflare@v0 from inside another action) cannot be tested before a release. That is the same limit build-jupyter-cache already has; see TESTING.md.
  • Two READMEs would need to stay in sync.
  • A copy-paste mistake would still be one line.

Revisit this only if the audience ever needs to be governed at the action level, for example restricting who may use the public variant.

Open questions

Sequencing

Start after PR #176 merges. Ideally this lands before the next release, so require-access never ships to consumers and making visibility required breaks nobody. If a release goes out first, making visibility required is a ⚠️ BREAKING change for anyone using require-access. In that case, keep require-access as a deprecated alias for one release, mapping true to private with a warning to add visibility, and say so in the CHANGELOG.

Checklist

  • visibility input: required, private or public, no default
  • Input cross-check: team-domain required for private, rejected for public, with the messages above
  • Public mode in the gate check, with before-deploy, after-deploy and alias checks inverted
  • Mode named in the first log line and the job summary heading; summary rows for public sites (for example "✅ public, served anonymously")
  • Harness: public-mode cases in dc-gate-probe; dc-inputs cases for a missing visibility and each rejected combination; a public-mode case in dc-refuses-ungated for a Worker that is unexpectedly gated
  • README (usage for both modes, inputs, what each mode proves, troubleshooting), CHANGELOG, QUICK-REFERENCE

Activity

  1. added
    enhancement
    on Sep 23, 2026
  2. mmcky commented on Nov 4, 2026

    @mmcky
    Contributor

    Decided 2026-11-04. require-access shipped in v0.12.0, so visibility arrives with require-access kept as a deprecated alias for one release: true maps to private, with a warning telling callers to switch to visibility. The alias is removed in the release after, with a ⚠️ CHANGELOG entry at that point. The chapter to update is docs/user/actions/deploy-cloudflare.md; the README is generated and QUICK-REFERENCE is gone.

    Posted by Claude Code (on behalf of mmcky), from the 2026-11-04 decision session.

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

    enhancement

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions