simplify github token env variable

This commit is contained in:
Tienson Qin
2026-02-27 13:34:17 +08:00
parent 9e57add57e
commit 3e918fd15d
5 changed files with 9 additions and 13 deletions

View File

@@ -181,8 +181,6 @@ Cloudflare runtime flow:
| CLOUDFLARE_HEALTH_RETRIES | Cloudflare sandbox health check retry count |
| CLOUDFLARE_HEALTH_INTERVAL_MS | Cloudflare sandbox health check retry interval (ms) |
| GITHUB_TOKEN | Fallback token used for both git push and PR API calls |
| GITHUB_PUSH_TOKEN | Optional token used only for git push (preferred over `GITHUB_TOKEN`) |
| GITHUB_PR_TOKEN | Optional token used only for PR creation (preferred over `GITHUB_TOKEN`) |
| GITHUB_API_BASE | Optional GitHub API base URL override (default `https://api.github.com`) |
| GITHUB_DEFAULT_BASE_BRANCH | Default PR base branch fallback (default `main`) |
| OPENAI_API_KEY | Passed into Cloudflare sandbox runtime env (if set) |
@@ -208,8 +206,7 @@ Response `status` values:
If PR credentials are missing or PR API creation fails after a successful push, response includes `manual-pr-url`.
For Cloudflare deploys, store tokens as agents worker secrets:
- `wrangler secret put GITHUB_PUSH_TOKEN -c worker/wrangler.agents.toml --env <staging|prod>`
- `wrangler secret put GITHUB_PR_TOKEN -c worker/wrangler.agents.toml --env <staging|prod>`
- `wrangler secret put GITHUB_TOKEN -c worker/wrangler.agents.toml --env <staging|prod>`
## Notes
- Protocol definitions live in `docs/agent-guide/db-sync/protocol.md`.

View File

@@ -100,13 +100,11 @@
(defn pr-token
[^js env]
(or (some-> (aget env "GITHUB_PR_TOKEN") non-empty-str)
(some-> (aget env "GITHUB_TOKEN") non-empty-str)))
(some-> (aget env "GITHUB_TOKEN") non-empty-str))
(defn push-token
[^js env]
(or (some-> (aget env "GITHUB_PUSH_TOKEN") non-empty-str)
(some-> (aget env "GITHUB_TOKEN") non-empty-str)))
(some-> (aget env "GITHUB_TOKEN") non-empty-str))
(defn push-remote-url
[repo-url token]

View File

@@ -45,8 +45,6 @@
:cloudflare-health-retries (env-value env "CLOUDFLARE_HEALTH_RETRIES")
:cloudflare-health-interval-ms (env-value env "CLOUDFLARE_HEALTH_INTERVAL_MS")
:github-token (env-value env "GITHUB_TOKEN")
:github-push-token (env-value env "GITHUB_PUSH_TOKEN")
:github-pr-token (env-value env "GITHUB_PR_TOKEN")
:github-api-base (env-value env "GITHUB_API_BASE")
:github-default-base-branch (env-value env "GITHUB_DEFAULT_BASE_BRANCH")
:openai-api-key (env-value env "OPENAI_API_KEY")
@@ -69,7 +67,7 @@
:cloudflare-sandbox-name-prefix :cloudflare-sandbox-agent-port
:cloudflare-bootstrap-command :cloudflare-repo-clone-command
:cloudflare-health-retries :cloudflare-health-interval-ms
:github-token :github-push-token :github-pr-token :github-api-base
:github-token :github-api-base
:github-default-base-branch
:openai-api-key :anthropic-api-key :openai-base-url :anthropic-base-url
:log-level :cognito-issuer :cognito-client-id :cognito-jwks-url])

View File

@@ -54,8 +54,6 @@
(aset "CLOUDFLARE_HEALTH_RETRIES" (:cloudflare-health-retries cfg))
(aset "CLOUDFLARE_HEALTH_INTERVAL_MS" (:cloudflare-health-interval-ms cfg))
(aset "GITHUB_TOKEN" (:github-token cfg))
(aset "GITHUB_PUSH_TOKEN" (:github-push-token cfg))
(aset "GITHUB_PR_TOKEN" (:github-pr-token cfg))
(aset "GITHUB_API_BASE" (:github-api-base cfg))
(aset "GITHUB_DEFAULT_BASE_BRANCH" (:github-default-base-branch cfg))
(aset "OPENAI_API_KEY" (:openai-api-key cfg))

5
deps/workers/worker/env_example vendored Normal file
View File

@@ -0,0 +1,5 @@
AGENT_RUNTIME_PROVIDER=cloudflare
SANDBOX_AGENT_TOKEN=${SANDBOX_AGENT_TOKEN}
SPRITE_TOKEN=${SPRITE_TOKEN}
GITHUB_TOKEN=${GITHUB_TOKEN}
GITHUB_DEFAULT_BASE_BRANCH=master