Skip to content

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

Guard upstream-only workflows in forks

tianma-if0b918fb3af17
diff --git a/.github/workflows/deploy-tools.yml b/.github/workflows/deploy-tools.yml
index 166e35d9..1da9089d 100644
--- a/.github/workflows/deploy-tools.yml
+++ b/.github/workflows/deploy-tools.yml
@@ -10,13 +10,12 @@ on:
- "scripts/wrangler-runner.mjs"
- "scripts/verify-deployment.mjs"
- ".dev.vars.example"
- - ".github/workflows/sync-edgeever-upstream.yml"
+ - ".github/workflows/**"
- "tests/deployment-entrypoints.test.ts"
- "tests/wrangler-runner.test.ts"
- "tests/deployment-verify.test.ts"
- "package.json"
- "bun.lock"
- - ".github/workflows/deploy-tools.yml"
push:
branches:
- main
@@ -28,19 +27,19 @@ on:
- "scripts/wrangler-runner.mjs"
- "scripts/verify-deployment.mjs"
- ".dev.vars.example"
- - ".github/workflows/sync-edgeever-upstream.yml"
+ - ".github/workflows/**"
- "tests/deployment-entrypoints.test.ts"
- "tests/wrangler-runner.test.ts"
- "tests/deployment-verify.test.ts"
- "package.json"
- "bun.lock"
- - ".github/workflows/deploy-tools.yml"
permissions:
contents: read
jobs:
wrangler:
+ if: github.repository == 'tianma-if/edgeever'
name: Wrangler runner (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml
index 3f9ab1d0..b974ce08 100644
--- a/.github/workflows/desktop-build.yml
+++ b/.github/workflows/desktop-build.yml
@@ -317,6 +317,7 @@ jobs:
if: >-
${{
always() &&
+ github.repository == 'tianma-if/edgeever' &&
needs.desktop.result == 'success' &&
(
(github.event_name == 'workflow_dispatch' && inputs.release_tag == '') ||
diff --git a/.github/workflows/extension-build.yml b/.github/workflows/extension-build.yml
index ee7c4b6f..2ad59c1a 100644
--- a/.github/workflows/extension-build.yml
+++ b/.github/workflows/extension-build.yml
@@ -22,6 +22,7 @@ permissions:
jobs:
build:
+ if: github.repository == 'tianma-if/edgeever'
name: Build Chromium and Firefox
runs-on: ubuntu-latest
timeout-minutes: 10
diff --git a/.github/workflows/ios-build.yml b/.github/workflows/ios-build.yml
index 3dfb1a09..bc396269 100644
--- a/.github/workflows/ios-build.yml
+++ b/.github/workflows/ios-build.yml
@@ -19,6 +19,7 @@ concurrency:
jobs:
build-and-test:
+ if: github.repository == 'tianma-if/edgeever'
name: Xcode build + unit tests
runs-on: macos-15
timeout-minutes: 45
diff --git a/.github/workflows/store-delivery.yml b/.github/workflows/store-delivery.yml
index d301a64f..f39cd552 100644
--- a/.github/workflows/store-delivery.yml
+++ b/.github/workflows/store-delivery.yml
@@ -102,7 +102,11 @@ jobs:
android:
needs: plan
- if: inputs.platform == 'android' || inputs.platform == 'both'
+ if: >-
+ ${{
+ github.repository == 'tianma-if/edgeever' &&
+ (inputs.platform == 'android' || inputs.platform == 'both')
+ }}
name: Deliver Google Play
runs-on: [self-hosted, macOS, ARM64, edgeever-mobile]
timeout-minutes: 60
@@ -176,7 +180,11 @@ jobs:
ios:
needs: plan
- if: inputs.platform == 'ios' || inputs.platform == 'both'
+ if: >-
+ ${{
+ github.repository == 'tianma-if/edgeever' &&
+ (inputs.platform == 'ios' || inputs.platform == 'both')
+ }}
name: Deliver App Store Connect
runs-on: ubuntu-latest
timeout-minutes: 90
diff --git a/tests/deployment-entrypoints.test.ts b/tests/deployment-entrypoints.test.ts
index f14883bd..4c217fe8 100644
--- a/tests/deployment-entrypoints.test.ts
+++ b/tests/deployment-entrypoints.test.ts
@@ -3,6 +3,7 @@ import { spawnSync } from "node:child_process";
import {
mkdirSync,
mkdtempSync,
+ readdirSync,
readFileSync,
rmSync,
writeFileSync,
@@ -210,6 +211,26 @@ describe("Cloudflare deployment entrypoints", () => {
expect(workflow).toContain("Prefer this workflow over GitHub **Sync fork**");
});
+ test("forks skip every workflow job except upstream updates", () => {
+ const workflowsDirectory = resolve(repositoryRoot, ".github/workflows");
+ const workflowFiles = readdirSync(workflowsDirectory)
+ .filter((file) => /\.ya?ml$/.test(file))
+ .filter((file) => file !== "sync-edgeever-upstream.yml");
+
+ for (const file of workflowFiles) {
+ const workflow = readRepositoryFile(`.github/workflows/${file}`);
+ const jobs = workflow.slice(workflow.indexOf("\njobs:\n") + "\njobs:\n".length);
+ const jobStarts = [...jobs.matchAll(/^ ([A-Za-z0-9_-]+):\s*$/gm)];
+
+ expect(jobStarts.length).toBeGreaterThan(0);
+ for (const [index, match] of jobStarts.entries()) {
+ const nextJob = jobStarts[index + 1];
+ const job = jobs.slice(match.index, nextJob?.index);
+ expect(job).toContain("github.repository == 'tianma-if/edgeever'");
+ }
+ }
+ });
+
test("keeps a forced-redeploy commit on the deploy-mirror update path", () => {
expect(
decideUpstreamSync({