The guide now opens with the outcome: content on Gitea had been 16 commits behind what the site pinned; D5 as built (CI's publish job merges with the job token and dispatches the deploy; a body marker stands in for Gitea's missing auto-merge flag); a dispatched run writes no commit status, so the publish job records the required check itself — softharbor's bot PRs will need the same; the runner facts; and the PD2/Qodana notes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6.8 KiB
poli0981-dev — migration guide
Written 2026-11-23 against
main@2ef3045. Profile: web (Astro, Cloudflare Workers) with an admin (admin.poli0981.dev), a widgets Worker and thesrc/contentsubmodule (poli0981/content). Docs live inpoli0981.dev-docs/; there is no CLAUDE.md. Shared decisions: README.
This repo talks to GitHub from its own code, not only from CI. That part is product work: plan it before the session.
Done 2026-11-24. Merged as Gitea #1 (the migration, v2.4.0) and #3 (v2.4.1, the publish fix below); main
deploys from the CI deploy job (wrangler deploy, then waits for /api/health), the admin saves and publishes
through Gitea with the poli0981-bot token, bug reports are confidential issues on the GitLab mirror, the widget
reads Gitea's public feed (it answers anonymously, PD3 verified). What the migration found:
contenton Gitea was 16 commits behind what the site pinned (98f7692): the import came from a stale clone. It was fast-forwarded from the site's submodule checkout before anything else. Comparegit ls-remotewith the pinned gitlink before trusting a submodule's forge copy.- D5 as built:
content-bump.ymlopens the PR and dispatchesci.ymlthroughscripts/content-publish.mjs; CI'spublishjob merges with the job token and dispatchesci.ymlonmainto deploy (a job-token merge starts no workflow, somerge_when_checks_succeedwould merge and never deploy). The PR body marker<!-- publish: auto|review -->stands in for the auto-merge flag Gitea's API lacks. - A dispatched run writes no commit status (Gitea 28.4: push and pull_request only), so the bump commit never got
the required
CI / build (*)and the first publish was refused (405). Thepublishjob (needs: build,if: always()) now records build's result asCI / build (workflow_dispatch)itself, then merges (#3). Any repo whose bot PRs rely on a dispatched check (softharbor) needs the same step. - Runner: a server started with
&in one step is gone in the next (start it and its tests in one step);astro previewonlocalhostlistened on ::1 only while Node's fetch went to 127.0.0.1 (--host 127.0.0.1);treosh/lighthouse-ci-actioncannot be unpacked on the runner (case-colliding paths on the Windows disk), so Lighthouse runsnpx --ignore-scripts @lhci/cli; gitleaks needed a.gitleaksignorefor four public identifiers (Access AUD, the Analytics site tag, the Sonar key, a forged test JWT). - PD2: reports still reach Discord (a degraded 202) while
GITLAB_ISSUES_TOKENis missing. Qodana stayed a local CLI job: the ops tag callers pin (v2026.11.1) has noreusable-qodana.yml.
Decided (2026-11-23)
- PD1 — the admin's "Publish" (D12):
src/lib/admin/github.tsmoves to the Gitea API with a token of the bot userpoli0981-bot, a collaborator with write access onpoli0981-devandcontentonly (a Worker secret of the admin, never an Actions secret). Dispatchingcontent-bump.ymlusesPOST …/actions/workflows/content-bump.yml/dispatcheswith that token (VERIFY that a collaborator's token may dispatch). - PD2 — the public bug report (D14): issues on the GitLab mirror through the GitLab API.
- PD3 — the widgets feed:
GET /api/v1/users/poli0981/activities/feedson Gitea, without a token. VERIFY that it answers anonymously and lists pushes and releases; if it does not, the widget goes. - D3 (deploy job with
wrangler deploy), D5 (content-bump's PR merges itself withmerge_when_checks_succeed), D2 (triage goes), D6 (buildis the required check).
Workflows (.github/workflows → .gitea/workflows)
| File | Today | Do |
|---|---|---|
ci.yml |
build (required), Sonar, upstream artifact actions, wrangler |
Move; Gitea artifact actions; remove Sonar (D1); deploy job on main with wrangler deploy (D3) |
content-bump.yml |
dispatched by the admin: bump src/content, push content/bump, gh pr create, gh pr merge --auto --squash (or comment and wait when MDX changed), gh workflow run ci.yml |
Gitea API (README table): create PR, merge with {do:"squash", merge_when_checks_succeed:true}, comment, dispatch ci.yml. permissions: contents: write, pull-requests: write, actions: write. PD1 for the caller |
lighthouse.yml |
advisory perf budget on PRs | Move |
osv-scanner.yml |
Google's osv-scanner reusable, SARIF, cron 17 3 * * 1 |
Delete → security.yml caller (node: true), cron 13 14 * * 3 |
qodana.yml |
qodana-action, SARIF to code scanning |
Caller of reusable-qodana.yml (package-manager: npm, prepare-command: npx astro sync if needed) |
triage.yml |
pull_request_target + scripts/triage.mjs |
Delete with the script (D2) |
.github/dependabot.yml → delete; add renovate.json.
Code, submodule, links
.gitmodules:src/content→https://git.poli0981.dev/poli0981/content.git(that repo must be on Gitea; there is a localE:\content).src/lib/admin/github.ts(PD1),src/pages/api/report.ts(PD2),workers/widgets/src/feeds.ts(PD3),src/components/admin/Dashboard.svelte(link), and their tests:tests/api-public.test.ts(5),tests/widgets-worker.test.ts(2),tests/support/github.ts.README.md(6),CONTRIBUTING.md(4),.github/ISSUE_TEMPLATE/config.yml(2),.github/pull_request_template.md(2),ACCESSIBILITY.md(2),public/.well-known/security.txt,poli0981.dev-docs/02_ARCHITECTURE.md,06_SECURITY.md,11_WIDGETS_INTEGRATIONS.md,12_LEGAL/CONTENT_LICENSE.md.CHANGELOG.mdkeeps its history.src/lib/links.ts(the GitHub profile link →https://git.poli0981.dev/poli0981) and the console note insrc/lib/easter.ts.- Add a short "Forge & CI" section to the docs (runbook §3.4); a CLAUDE.md would be the place if you add one.
The content submodule (poli0981/content, E:\content)
Checked 2026-11-23 at main @ 9265c94: already on Gitea (origin), no workflows, no secrets, no code. Migrate it in the same session as poli0981-dev:
README.md: the link topoli0981/poli0981-dev→ Gitea.projects/poli0981-dev.md,projects/frameledger.md:repo:→https://git.poli0981.dev/poli0981/<repo>(the schema isz.url(), any host passes).legal/licenses.md(the EN and the VI paragraph): source on Gitea, issues on the GitLab mirror. A link edit, not a material change, so no consent bump (the ticktune precedent).- No
renovate.jsonand no security caller: nothing to scan. The GitLab mirror and branch protection apply as for any repo. - The content commit lands first;
poli0981-dev's.gitmoduleschange and the submodule bump follow in its PR.
Secrets
Keep QODANA_TOKEN. Create (user level): CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID (D3). Drop SONAR_TOKEN. Outside Actions, as Worker secrets: the poli0981-bot token (PD1, D12) and the GitLab token of the report endpoint (PD2, D14).