Skip to content

Build your personal knowledge base with Trilium Notes

ci: guard fork-hostile automation and publish jobs with vars.REPO_MAIN

matt wilkie70ecb343095c
diff --git a/.github/workflows/main-docker.yml b/.github/workflows/main-docker.yml
index cdf3f3862e..811ac36901 100644
--- a/.github/workflows/main-docker.yml
+++ b/.github/workflows/main-docker.yml
@@ -109,6 +109,9 @@ jobs:
build:
name: Build Docker images
+ # Only the main repository publishes. merge declares needs: build, so it skips with
+ # this job; test_docker stays unguarded because it uses no secrets.
+ if: ${{ github.repository == vars.REPO_MAIN }}
strategy:
fail-fast: false
matrix:
diff --git a/.github/workflows/sync-readme.yml b/.github/workflows/sync-readme.yml
index 6fbf2805a1..e3ccda3e34 100644
--- a/.github/workflows/sync-readme.yml
+++ b/.github/workflows/sync-readme.yml
@@ -32,6 +32,9 @@ permissions:
jobs:
sync-readme:
name: Regenerate the translation base README
+ # Only the repository Weblate translates from needs the regenerated base, and a fork
+ # replays the README push when it syncs main.
+ if: ${{ github.repository == vars.REPO_MAIN }}
runs-on: ubuntu-latest
permissions:
contents: write
diff --git a/.github/workflows/update-model-prices.yml b/.github/workflows/update-model-prices.yml
index 2765b55107..7dae177515 100644
--- a/.github/workflows/update-model-prices.yml
+++ b/.github/workflows/update-model-prices.yml
@@ -15,6 +15,9 @@ permissions:
jobs:
update-model-prices:
name: Refresh model_prices.json
+ # Forks inherit the schedule, and the PR this opens is only useful in the repository
+ # model_prices.json ships from.
+ if: ${{ github.repository == vars.REPO_MAIN }}
runs-on: ubuntu-latest
permissions:
contents: write
diff --git a/.github/workflows/update-nix-flake.yml b/.github/workflows/update-nix-flake.yml
index 76754b174f..ef50043f77 100644
--- a/.github/workflows/update-nix-flake.yml
+++ b/.github/workflows/update-nix-flake.yml
@@ -33,6 +33,9 @@ permissions:
jobs:
electron-pin:
name: Sync the pinned Electron binary
+ # A fork replays the package.json bump when it syncs main, so without the guard it
+ # opens the flake PR against a pin it does not own.
+ if: ${{ github.repository == vars.REPO_MAIN }}
runs-on: ubuntu-latest
permissions:
contents: write
diff --git a/.github/workflows/update-pdfjs-viewer.yml b/.github/workflows/update-pdfjs-viewer.yml
index eca30914a5..caa23b613e 100644
--- a/.github/workflows/update-pdfjs-viewer.yml
+++ b/.github/workflows/update-pdfjs-viewer.yml
@@ -30,6 +30,9 @@ permissions:
jobs:
vendor-viewer:
+ # Forks inherit the schedule, and the bump PR is only useful in the repository
+ # pdfjs-dist is pinned from.
+ if: ${{ github.repository == vars.REPO_MAIN }}
# Matched to the e2e-pdfjs-viewer job in playwright.yml, which runs the same suite.
runs-on: ubuntu-22.04
name: Bump pdf.js and re-vendor the viewer