Repository navigation
Allow sign-in from reportbase.github.io; deploy automatically on merge - #2
Merged
Merged
Conversation
Sign-in failed from the GitHub Pages site: ALLOWED_ORIGINS held only tangent.fit and localhost, so the gateway refused to hand a session back to https://reportbase.github.io, where games (the chess coach), draw (the AI button) and 3d (describe it) live. One entry covers all three, since an origin is only scheme and host. A comment warns against ever widening it to *.github.io, which would let anyone's GitHub Pages site use the key. npm test looked for test/*.test.mjs importing ../src/, but the files sit at the root, so it ran nothing. The test and its D1 stand-in move to test/ and import from the root. A new test reads ALLOWED_ORIGINS from wrangler.toml itself and checks the Pages site is allowed while other github.io sites and look-alike hosts are not. 30 tests pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yy9hSCgHQ5WYRZu4JMuW9
.github/workflows/deploy.yml: on push to main (or by hand from the Actions tab), run the tests, then npm ci and wrangler deploy, using the CLOUDFLARE_API_TOKEN repository secret, the same setup flare uses. Without the secret the deploy is skipped with a warning. A deploy sends the code and wrangler.toml; the Worker's secrets and the D1 data are untouched. .github/workflows/test.yml runs npm test on pull requests and on main. wrangler ^4 is now a devDependency with a lockfile, so a deploy installs a known version. README explains making the token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yy9hSCgHQ5WYRZu4JMuW9
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.
Sign-in failed from the GitHub Pages site: the gateway answers
redirect_uri is missing or its origin is not in ALLOWED_ORIGINS. This PR fixes that and makes merges deploy automatically. One commit each.1. Allow the Pages site
wrangler.toml: addhttps://reportbase.github.iotoALLOWED_ORIGINS.*.github.io, which would let anyone's GitHub Pages site spend the key.Tests now run.
npm testlooked fortest/*.test.mjsimporting../src/, but the files were at the root, so it ran nothing. They move totest/and import from the root.New test. It reads
ALLOWED_ORIGINSfromwrangler.tomland checks:github.iosites, look-alike hosts and plainhttp://are refusedIt fails without the new entry. All 30 tests pass.
2. Deploy on merge
Same setup as flare:
Deployworkflow: on push tomain(or by hand from the Actions tab), it runs the tests, thennpm ciandwrangler deploywith theCLOUDFLARE_API_TOKENrepository secret. Without the secret it skips the deploy with a warning.Testsworkflow: runsnpm teston every PR.^4is now a devDependency with a lockfile, so a deploy installs a known version.npm cipluswrangler deploy --dry-runbuilds the Worker, with the D1 binding and every var in place.To make it live
CLOUDFLARE_API_TOKEN(Settings → Secrets and variables → Actions). The token made for flare works, if you kept it; otherwise make another from the "Edit Cloudflare Workers" template.https://login.tangent.workers.dev.🤖 Generated with Claude Code
https://claude.ai/code/session_015yy9hSCgHQ5WYRZu4JMuW9