From 3e918fd15dcebdec8ffb4bef32e82d278038c655 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Fri, 27 Feb 2026 13:34:17 +0800 Subject: [PATCH] simplify github token env variable --- deps/workers/README.md | 5 +---- deps/workers/src/logseq/agents/source_control.cljs | 6 ++---- deps/workers/src/logseq/sync/node/config.cljs | 4 +--- deps/workers/src/logseq/sync/node/server.cljs | 2 -- deps/workers/worker/env_example | 5 +++++ 5 files changed, 9 insertions(+), 13 deletions(-) create mode 100644 deps/workers/worker/env_example diff --git a/deps/workers/README.md b/deps/workers/README.md index 2e3b186b39..f143997768 100644 --- a/deps/workers/README.md +++ b/deps/workers/README.md @@ -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 ` -- `wrangler secret put GITHUB_PR_TOKEN -c worker/wrangler.agents.toml --env ` +- `wrangler secret put GITHUB_TOKEN -c worker/wrangler.agents.toml --env ` ## Notes - Protocol definitions live in `docs/agent-guide/db-sync/protocol.md`. diff --git a/deps/workers/src/logseq/agents/source_control.cljs b/deps/workers/src/logseq/agents/source_control.cljs index 5a7213dcdb..2353de8697 100644 --- a/deps/workers/src/logseq/agents/source_control.cljs +++ b/deps/workers/src/logseq/agents/source_control.cljs @@ -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] diff --git a/deps/workers/src/logseq/sync/node/config.cljs b/deps/workers/src/logseq/sync/node/config.cljs index fccdcb5594..6dbd50eefb 100644 --- a/deps/workers/src/logseq/sync/node/config.cljs +++ b/deps/workers/src/logseq/sync/node/config.cljs @@ -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]) diff --git a/deps/workers/src/logseq/sync/node/server.cljs b/deps/workers/src/logseq/sync/node/server.cljs index c770550386..7e0b421b91 100644 --- a/deps/workers/src/logseq/sync/node/server.cljs +++ b/deps/workers/src/logseq/sync/node/server.cljs @@ -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)) diff --git a/deps/workers/worker/env_example b/deps/workers/worker/env_example new file mode 100644 index 0000000000..8bb0deae37 --- /dev/null +++ b/deps/workers/worker/env_example @@ -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