Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix: handle direct upload Pages projects

yomaa1ce678a114d
diff --git a/.env.local.example b/.env.local.example
index 69d3bbfd..32606632 100644
--- a/.env.local.example
+++ b/.env.local.example
@@ -28,10 +28,11 @@ EDGE_EVER_BUILDS_API_TOKEN=
# The selected build token must be able to apply D1 migrations and deploy Workers.
EDGE_EVER_BUILDS_BUILD_TOKEN_UUID=
-# Optional: set this only when this repository also deploys an Astro/PAGES site.
-# `bun run deploy:builds:setup` then limits that Pages project's Git builds to
-# apps/site/* plus shared root dependency files. The User API Token also needs
-# Account -> Cloudflare Pages -> Edit. Leave empty for normal EdgeEver forks.
+# Optional: set this only for a Git-integrated Cloudflare Pages project.
+# `bun run deploy:builds:setup` then limits its Git builds to apps/site/* plus
+# shared root dependency files. The User API Token also needs Account ->
+# Cloudflare Pages -> Edit. Direct Upload projects use their deploy workflow's
+# path filters instead, so leave this empty for those projects.
EDGE_EVER_PAGES_PROJECT_NAME=
# Worker service name.
diff --git a/docs/cloudflare-workers-builds.md b/docs/cloudflare-workers-builds.md
index a057e097..2db9a0e2 100644
--- a/docs/cloudflare-workers-builds.md
+++ b/docs/cloudflare-workers-builds.md
@@ -39,7 +39,9 @@ This token is used only by `bun run deploy:builds:setup` and is never uploaded t
The Worker trigger already ignores changes limited to `apps/site/*`, `apps/mobile/*`, `apps/extension/*`, `docs/*`, README files, and `.github/*`. Thus a website-only change does not deploy the EdgeEver Worker.
-For a Cloudflare Pages project in this repository, set `EDGE_EVER_PAGES_PROJECT_NAME` and rerun `bun run deploy:builds:setup`. The command configures Pages Build watch paths to `apps/site/*`, `bun.lock`, and `package.json`, so product-only changes do not rebuild the website. This optional step requires the User API Token to additionally have **Account** -> **Cloudflare Pages** -> **Edit**. Without automation, set the same paths in **Pages project** -> **Settings** -> **Build** -> **Build watch paths**.
+For a Git-integrated Cloudflare Pages project, set `EDGE_EVER_PAGES_PROJECT_NAME` and rerun `bun run deploy:builds:setup`. The command configures Pages Build watch paths to `apps/site/*`, `bun.lock`, and `package.json`, so product-only changes do not rebuild the website. This optional step requires the User API Token to additionally have **Account** -> **Cloudflare Pages** -> **Edit**. Without automation, set the same paths in **Pages project** -> **Settings** -> **Build** -> **Build watch paths**.
+
+Cloudflare cannot set Build watch paths on a **Direct Upload** Pages project. In that case, keep the filter in the deploy workflow instead. This repository's `.github/workflows/deploy-site.yml` already runs only for website/docs/shared-build-input changes, so application-only changes do not deploy the official site.
### Manual fallback
diff --git a/docs/cloudflare-workers-builds.zh-CN.md b/docs/cloudflare-workers-builds.zh-CN.md
index db2b151d..771bbfc1 100644
--- a/docs/cloudflare-workers-builds.zh-CN.md
+++ b/docs/cloudflare-workers-builds.zh-CN.md
@@ -40,7 +40,9 @@ Cloudflare 有两项账号级授权,仓库脚本不能、也不应该绕过:
Worker 触发器已经排除了仅发生在 `apps/site/*`、`apps/mobile/*`、`apps/extension/*`、`docs/*`、README 文件和 `.github/*` 中的变更。因此,仅改官网不会发布 EdgeEver Worker。
-如果这个仓库还部署了 Cloudflare Pages 官网,请设置 `EDGE_EVER_PAGES_PROJECT_NAME`,再重跑 `bun run deploy:builds:setup`。命令会将 Pages 的 Build watch paths 设为 `apps/site/*`、`bun.lock`、`package.json`;这样仅改产品代码不会重新构建官网。该可选步骤要求 User API Token 额外拥有 **Account** -> **Cloudflare Pages** -> **Edit**。不使用自动化时,在 **Pages 项目** -> **Settings** -> **Build** -> **Build watch paths** 填入同样的路径即可。
+如果这个仓库还部署了 **Git 集成** 的 Cloudflare Pages 官网,请设置 `EDGE_EVER_PAGES_PROJECT_NAME`,再重跑 `bun run deploy:builds:setup`。命令会将 Pages 的 Build watch paths 设为 `apps/site/*`、`bun.lock`、`package.json`;这样仅改产品代码不会重新构建官网。该可选步骤要求 User API Token 额外拥有 **Account** -> **Cloudflare Pages** -> **Edit**。不使用自动化时,在 **Pages 项目** -> **Settings** -> **Build** -> **Build watch paths** 填入同样的路径即可。
+
+Cloudflare 无法为 **Direct Upload(直接上传)** 类型的 Pages 项目设置 Build watch paths;此时应由部署工作流本身过滤路径。本仓库的 `.github/workflows/deploy-site.yml` 已只监听官网、文档及共享构建输入的改动,因此仅改笔记应用不会触发官网部署。
### 手动兜底
diff --git a/scripts/cloudflare-workers-builds.mjs b/scripts/cloudflare-workers-builds.mjs
index fb44ea58..90bdfa26 100644
--- a/scripts/cloudflare-workers-builds.mjs
+++ b/scripts/cloudflare-workers-builds.mjs
@@ -150,18 +150,26 @@ const triggerPayload = (workerTag, repoConnectionUuid, buildTokenUuid) => ({
const configurePagesWatchPaths = async () => {
if (!pagesProjectName) return;
- await request("PATCH", `/accounts/${accountId}/pages/projects/${encodeURIComponent(pagesProjectName)}`, {
- source: {
- config: {
- // `*` spans nested directories in Cloudflare Pages. Root lockfiles and
- // package metadata are shared build inputs, so they intentionally trigger
- // both projects when changed.
- path_includes: ["apps/site/*", "bun.lock", "package.json"],
- path_excludes: [],
+ try {
+ await request("PATCH", `/accounts/${accountId}/pages/projects/${encodeURIComponent(pagesProjectName)}`, {
+ source: {
+ config: {
+ // `*` spans nested directories in Cloudflare Pages. Root lockfiles and
+ // package metadata are shared build inputs, so they intentionally trigger
+ // both projects when changed.
+ path_includes: ["apps/site/*", "bun.lock", "package.json"],
+ path_excludes: [],
+ },
},
- },
- });
- console.log(`[ok] configured Pages watch paths for ${pagesProjectName}`);
+ });
+ console.log(`[ok] configured Pages watch paths for ${pagesProjectName}`);
+ } catch (error) {
+ if (error instanceof Error && error.message.includes("Direct Uploads project")) {
+ console.log(`[skip] ${pagesProjectName} is a Direct Upload Pages project; its deploy workflow already controls path filtering.`);
+ return;
+ }
+ throw error;
+ }
};
const setup = async () => {