saturn
- 187 commits
- 2 branches
- 0 tags
- updated
- CI 2/2
feat: pull commits from tangled
SignedGitea couldn't verify the signature.
Showing 6 changed files with 53 additions and 34 deletions.
.tangled/workflows/mirror.yml
+22 −4
@@ -1,6 +1,7 @@11# mirrors main to github and gitea on every push. tangled is the source of2# truth, so both get force-pushed to match it. needs the GH_MIRROR_TOKEN and3# GITEA_MIRROR_TOKEN secrets2# truth, so both get force-pushed to match it. the same file works in every3# repo: it pushes to the repo with the same name on github and gitea.4# needs the GH_MIRROR_TOKEN and GITEA_MIRROR_KEY secrets4556when:67 - event: ["push", "manual"]@@ -8,6 +9,10 @@ when:89910engine: "nixery"101112dependencies:13 nixpkgs:14 - openssh151116steps:1217 # spindle clones one commit deep (depth: 0 means 1 too), and the mirrors1318 # need the whole history. this also points origin/main at the newest main,@@ -20,9 +25,22 @@ steps:2025 - name: "Mirror to GitHub"2126 command: |2227 set -euo pipefail23 git push --force "https://x-access-token:${GH_MIRROR_TOKEN}@github.com/daniel-daum/saturn.git" refs/remotes/origin/main:refs/heads/main28 git push --force "https://x-access-token:${GH_MIRROR_TOKEN}@github.com/daniel-daum/${TANGLED_REPO_NAME}.git" refs/remotes/origin/main:refs/heads/main242930 # over ssh to git-ssh, which skips cloudflare. https to git.danieldaum.net31 # goes through it, and its bot protection blocks spindle at random2532 - name: "Mirror to Gitea"2633 command: |2734 set -euo pipefail28 git push --force "https://daniel-daum:${GITEA_MIRROR_TOKEN}@git.danieldaum.net/daniel-daum/saturn.git" refs/remotes/origin/main:refs/heads/main3536 # ssh refuses to run without a passwd entry, and nixery images have none37 mkdir -p /etc38 [ -e /etc/passwd ] || echo "root:x:0:0:root:${HOME}:/bin/bash" > /etc/passwd3940 mkdir -p "${HOME}/.ssh"41 printf '%s\n' "${GITEA_MIRROR_KEY}" > "${HOME}/.ssh/gitea"42 chmod 600 "${HOME}/.ssh/gitea"43 ssh-keyscan -p 2222 git-ssh.danieldaum.net > "${HOME}/.ssh/known_hosts"4445 export GIT_SSH_COMMAND="ssh -i ${HOME}/.ssh/gitea -o IdentitiesOnly=yes -o UserKnownHostsFile=${HOME}/.ssh/known_hosts"46 git push --force "ssh://git@git-ssh.danieldaum.net:2222/daniel-daum/${TANGLED_REPO_NAME}.git" refs/remotes/origin/main:refs/heads/main
internal/site-guide.md
+3 −3
@@ -255,17 +255,17 @@ A project shows up in three places, newest first:255255256256**Pills.** `<div class="pills">` with `<span class="pill">#new</span>`. `#in-development` also carries `pill--dev`, a pulsing dot that is commented out in `global.css` for now. They're grey, never lime. Take them off when the project isn't new any more.257257258**Commit log.** `scripts/sync-commits.mjs` reads recent commits from my Gitea's public API and writes them between `<!-- commits:<repo>:<count> -->` markers. It runs with the hourly sync, or locally with `mise run sync-commits`. To add a repo, put the markers inside a `.commit-log` and add the page to `PAGES` in the script. On the `/projects/` card, the log is `aria-hidden` because the whole card is a link, and it hides the hash to save room.258**Commit log.** `scripts/sync-commits.mjs` reads recent commits from the Tangled knot (`knot1.tangled.sh`, `sh.tangled.repo.log`, no login) and writes them between `<!-- commits:<repo>:<count> -->` markers. It runs with the hourly sync, or locally with `mise run sync-commits`. To add a repo, put the markers inside a `.commit-log` and add the page to `PAGES` in the script. On the `/projects/` card, the log is `aria-hidden` because the whole card is a link, and it hides the hash to save room.259259260260## 8. ci (tangled spindle)261261262262Three workflows in `.tangled/workflows/`, run by the public spindle (`spindle.tangled.sh`). Status shows under Pipelines on the repo page.263263264264- **deploy.yml** (every push to `main`): stages the public files and runs `npx wrangler@4 pages deploy`.265- **mirror.yml** (every push to `main`): force-pushes the newest `main` to GitHub and Gitea. Never push to those directly; it gets overwritten.265- **mirror.yml** (every push to `main`): force-pushes the newest `main` to GitHub (https + token) and Gitea (ssh to `git-ssh.danieldaum.net:2222`, which skips Cloudflare; https to `git.danieldaum.net` goes through Cloudflare's bot protection, which blocks spindle at random). Never push to those directly; it gets overwritten.266266- **sync.yml** (hourly, plus Retry): checks out the newest `main`, runs the three sync scripts, and if anything changed commits "chore: sync" and pushes back over SSH, which runs deploy and mirror.267267268**Secrets** (Tangled → saturn → Settings → Pipelines): `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID`, `GH_MIRROR_TOKEN` (GitHub, contents write on this repo), `GITEA_MIRROR_TOKEN`, `ATPROTO_APP_PASSWORD`, `TANGLED_PUSH_KEY` (private half of the `saturn-spindle` SSH key on my Tangled account).268**Secrets** (Tangled → saturn → Settings → Pipelines): `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID`, `GH_MIRROR_TOKEN` (GitHub, contents write on this repo), `GITEA_MIRROR_KEY` (private half of the `spindle-mirror` SSH key on my Gitea account), `ATPROTO_APP_PASSWORD`, `TANGLED_PUSH_KEY` (private half of the `saturn-spindle` SSH key on my Tangled account).269269270270**Gotchas** (nixery engine):271271
mise.toml
+1 −1
@@ -19,7 +19,7 @@ run = "node scripts/sync-standard.mjs"19192020# mise run sync-commits2121[tasks.sync-commits]22description = "Copy recent commits from my gitea into the project pages"22description = "Copy recent commits from tangled into the project pages"2323run = "node scripts/sync-commits.mjs"24242525# mise run words now/sep-2026/index.html
projects/holonet/index.html
+8 −8
@@ -204,12 +204,17 @@204204 <div class="commit-log-head">205205 <span>recent commits</span>206206 <a207 href="https://git.danieldaum.net/daniel-daum/holonet/commits/branch/main"207 href="https://tangled.org/danieldaum.net/holonet/commits/main"208208 >all commits →</a209209 >210210 </div>211211 <!-- commits:holonet:6 -->212212 <ol class="commit-log-list">213 <li class="commit-log-row">214 <span class="commit-log-hash">49fc1c5</span>215 <span class="commit-log-msg">feat: migrate to tangled</span>216 <time class="commit-log-date" datetime="2026-10-08T18:24:43-07:00">08 Oct 26</time>217 </li>213218 <li class="commit-log-row">214219 <span class="commit-log-hash">3b951c1</span>215220 <span class="commit-log-msg">feat: add containerization</span>@@ -235,11 +240,6 @@235240 <span class="commit-log-msg">feat: track binary assets with lfs</span>236241 <time class="commit-log-date" datetime="2026-09-09T14:27:21-07:00">09 Sep 26</time>237242 </li>238 <li class="commit-log-row">239 <span class="commit-log-hash">ab80309</span>240 <span class="commit-log-msg">wip: capture env vars, init http server</span>241 <time class="commit-log-date" datetime="2026-09-08T20:44:09-07:00">08 Sep 26</time>242 </li>243243 </ol>244244 <!-- /commits:holonet:6 -->245245 </div>@@ -283,11 +283,11 @@283283 <p class="project-stat-label">source</p>284284 <p class="project-stat-value">285285 <a286 href="https://git.danieldaum.net/daniel-daum/holonet"286 href="https://tangled.org/danieldaum.net/holonet"287287 aria-label="link to holonet's source code, opens in new tab"288288 target="_blank"289289 rel="noopener noreferrer"290 >git.danieldaum.net/daniel-daum/holonet</a290 >tangled.org/danieldaum.net/holonet</a291291 >292292 </p>293293 </div>
projects/index.html
+5 −5
@@ -143,6 +143,11 @@143143 <div class="commit-log-head">recent commits</div>144144 <!-- commits:holonet:4 -->145145 <ol class="commit-log-list">146 <li class="commit-log-row">147 <span class="commit-log-hash">49fc1c5</span>148 <span class="commit-log-msg">feat: migrate to tangled</span>149 <time class="commit-log-date" datetime="2026-10-08T18:24:43-07:00">08 Oct 26</time>150 </li>146151 <li class="commit-log-row">147152 <span class="commit-log-hash">3b951c1</span>148153 <span class="commit-log-msg">feat: add containerization</span>@@ -158,11 +163,6 @@158163 <span class="commit-log-msg">feat: add godot client</span>159164 <time class="commit-log-date" datetime="2026-09-09T14:38:45-07:00">09 Sep 26</time>160165 </li>161 <li class="commit-log-row">162 <span class="commit-log-hash">f7ada9f</span>163 <span class="commit-log-msg">fix: remove svg from lfs tracking</span>164 <time class="commit-log-date" datetime="2026-09-09T14:37:43-07:00">09 Sep 26</time>165 </li>166166 </ol>167167 <!-- /commits:holonet:4 -->168168 </div>
scripts/sync-commits.mjs
+14 −13
@@ -1,4 +1,5 @@1// pulls recent commits from my gitea and writes them into the static html.1// pulls recent commits from my repos on tangled and writes them into the2// static html.23// run with `mise run sync-commits`. no dependencies, node 18+.34//45// a page opts in with a pair of marker comments naming the repo and how many@@ -6,13 +7,14 @@67//78// <!-- commits:holonet:6 -->...<!-- /commits:holonet:6 -->89//9// commits come from the repo's default branch, newest first. if gitea can't10// be reached, the script exits non-zero and touches nothing.10// commits come from main, newest first, read from the knot that hosts my11// repos (no login needed). if it can't be reached, the script exits non-zero12// and touches nothing.11131214import { readFile, writeFile } from "node:fs/promises";131514const GITEA = "https://git.danieldaum.net";15const OWNER = "daniel-daum";16const KNOT = "https://knot1.tangled.sh";17const OWNER = "did:plc:e3z5gj5iyuwgqao562bo4bdf"; // danieldaum.net1618const TZ = "America/Los_Angeles";17191820const PAGES = ["projects/index.html", "projects/holonet/index.html"];@@ -23,15 +25,14 @@ const MARKER = /^([ \t]*)<!-- commits:([\w.-]+):(\d+) -->[\s\S]*?<!-- \/commits:2325// data24262527async function fetchCommits(repo, limit) {26 const url = new URL(`/api/v1/repos/${OWNER}/${repo}/commits`, GITEA);28 const url = new URL("/xrpc/sh.tangled.repo.log", KNOT);29 url.searchParams.set("repo", `${OWNER}/${repo}`);30 url.searchParams.set("ref", "main");2731 url.searchParams.set("limit", String(limit));28 // skip diff stats, signature checks and file lists, none of it is shown29 url.searchParams.set("stat", "false");30 url.searchParams.set("verification", "false");31 url.searchParams.set("files", "false");3232 const res = await fetch(url);3333 if (!res.ok) throw new Error(`${repo} commits: ${res.status} ${res.statusText}`);34 return res.json();34 const { commits } = await res.json();35 return commits.map((c) => ({ sha: c.this, message: c.message, date: c.author.When }));3536}36373738// ---------------------------------------------------------------------------@@ -43,8 +44,8 @@ function render(commits) {4344 [4445 ` <li class="commit-log-row">`,4546 ` <span class="commit-log-hash">${c.sha.slice(0, 7)}</span>`,46 ` <span class="commit-log-msg">${esc(c.commit.message.split("\n")[0])}</span>`,47 ` <time class="commit-log-date" datetime="${esc(c.commit.author.date)}">${formatDate(c.commit.author.date)}</time>`,47 ` <span class="commit-log-msg">${esc(c.message.split("\n")[0])}</span>`,48 ` <time class="commit-log-date" datetime="${esc(c.date)}">${formatDate(c.date)}</time>`,4849 ` </li>`,4950 ].join("\n"),5051 );