From c506fbe4cd259f152134f86da834839efda363ee Mon Sep 17 00:00:00 2001 From: Cypress Reed Date: Thu, 30 Jul 2026 17:04:21 -0600 Subject: [PATCH] add tangled mirror workflow --- .tangled/workflows/mirror.yml | 21 +++++++++++++++++++++ README.md | 15 +++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .tangled/workflows/mirror.yml diff --git a/.tangled/workflows/mirror.yml b/.tangled/workflows/mirror.yml new file mode 100644 index 0000000..83cc382 --- /dev/null +++ b/.tangled/workflows/mirror.yml @@ -0,0 +1,21 @@ +when: + - event: ["push"] + branch: ["*"] + - event: ["push"] + tag: ["*"] +engine: "nixery" +clone: + depth: 0 + submodules: false +dependencies: + nixpkgs: + - git + - cacert +steps: + - name: "Mirror branches and tags to GitHub" + command: | + set -eu + : "${GITHUB_TOKEN:?Set the GitHub personal access token as a Tangled secret named GITHUB_TOKEN}" + : "${GITHUB_REPOSITORY:?Set the GitHub owner/repository as a Tangled secret named GITHUB_REPOSITORY}" + git clone --mirror "$TANGLED_REPO_URL" github-mirror.git + git -C github-mirror.git push --mirror "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" diff --git a/README.md b/README.md index 73b83d6..f4fa1d1 100644 --- a/README.md +++ b/README.md @@ -278,3 +278,18 @@ The optional infrastructure repository contains a rootless Podman service at `spruce-infra/panel-modeler/` that serves a self-hosted database internally at `http://panel-modeler-panels/panels.json`. The GUI can use that URL from the Panel Database dialog. + +## Mirroring to GitHub + +Tangled is the source of truth for this repository. The Tangled pipeline at +[`.tangled/workflows/mirror.yml`](.tangled/workflows/mirror.yml) mirrors every branch +and tag push to GitHub. + +Configure these repository secrets in Tangled: + +- `GITHUB_TOKEN`: a GitHub fine-grained personal access token with **Contents: Read and write** permission on the destination repository +- `GITHUB_REPOSITORY`: the GitHub destination in `owner/repository` form + +The workflow uses `git push --mirror`, so the GitHub repository should be dedicated to +this mirror and should not receive independent changes. The destination must already +exist on GitHub. -- knotmirror 0.0.1