- ci: move the workflows to Gitea Actions (D38) - feat(site): source on Gitea, issues and bug reports on the GitLab mirror - docs: where the project lives now — Gitea, the GitLab mirror, e-mail - docs: the suite on Gitea — D38, CI/CD rewritten, every GitHub-era claim synced - fix(ci): what the first Gitea runs found — Qodana and gitleaks - fix(ci): .gitleaksignore describes the Sonar key instead of quoting it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 KiB
12 — CI/CD & Repo Automation
Forge since 2026-11-24 (D38): the repository lives on the owner's Gitea,
https://git.poli0981.dev/poli0981/softharbor(origin); CI is Gitea Actions in.gitea/workflows/; the public files issues and merge requests on the push mirrorgitlab.com/poli0981/softharbor, where no CI runs. The GitHub account was suspended in November 2026 — thegithubremote is kept for history and never pushed. The procedure every repository of the owner followed is the runbookdocs/GITEA-MIGRATION.mdinpoli0981/.github(itsdocs/migration/softharbor.mdis this repository's guide); for migration topics it wins over this file.
1. Overview
PR ──▶ CI (build + gates) + Security + Qodana ──▶ review ──▶ squash to main
│
┌───────────────────────────────────────────────────────┤
▼ ▼
CI `deploy` job (push to main only) quarantine.yml (paths)
pnpm build ─▶ wrangler deploy ─▶ wait until production serves the build
cron (13:00–16:00 UTC only) ─▶ quarantine 13:17 daily · vt-recheck 13:59 daily
· link-check Mon 14:43 · Security Tue 15:37 · Renovate (central, 13:31)
release published by hand ─▶ notify.yml ─▶ Discord
The runner is the maintainer's PC. One Gitea runner, user-scoped to the
poli0981 repositories; ubuntu-latest jobs run in Docker
(docker.gitea.com/runner-images) as root. Consequences:
- Jobs run only while the PC is on. A scheduled run whose slot passes
while it is off waits as "waiting" and starts when the runner comes back;
after 24 h unpicked it is cancelled (Gitea's
ABANDONED_JOB_TIMEOUT). Delays are accepted (runbook §7). - Every cron sits inside 13:00–16:00 UTC (20:00–23:00 Vietnam), on a
minute no other repository of the owner uses — the slots are registered in
poli0981/.githubdocs/migration/README.md. Never schedule inside Gitea's nightly backup window (19:30–19:45 UTC). NoTZ=prefix. - Background processes die with their step (a server started with
&is gone in the next step), and inside the containerlocalhostcan resolve to::1for a server and to127.0.0.1for a client — soplaywright.config.tsbinds and calls127.0.0.1explicitly, and starts its servers itself. - Artifact uploads are
continue-on-error. They usechristopherhx/gitea-upload-artifact(upstream v4 refuses non-GitHub servers), and the route from the runner to the artifact store has dropped uploads mid-way (ticktune, 2026-11-23) — a lost report must never make a red run confusing. - No macOS runner, no OIDC, no code-scanning UI, no Dependabot, no CodeQL (runbook §1). What replaced each is below.
Permissions. Every workflow declares permissions: {} at the top and
grants per job; checkouts use persist-credentials: false. The job token is
${{ github.token }} (Gitea also calls it GITEA_TOKEN); its API is
${{ github.api_url }} (https://git.poli0981.dev/api/v1). Gitea knows
contents, issues, pull-requests, actions and packages; GitHub-only
scopes (id-token, checks, security-events, statuses, …) are gone from
every workflow.
Two Gitea facts shape the bots (runbook §6):
- An event caused by the job token starts no workflow — as on GitHub.
A branch the bot pushes, or a PR it opens, runs no
pull_requestchecks, so the bot dispatchesci.ymlandsecurity.ymlon its branch. - A dispatched run writes no commit status (measured on Gitea 28.4 by
poli0981-dev, 2026-11-24): its checks never meet branch protection.
ci.yml'srecordjob therefore writes build's and gates' results as statuses itself, namedCI / build (workflow_dispatch)andCI / gates (workflow_dispatch)— names the protection patterns match.
scripts/gitea.mjs is the bots' side of the forge — PRs, dispatches,
issues, statuses — over the REST API with the job token (no gh: it only
talks to github.com). Its tests run it against an in-process stand-in for
the API (scripts/gitea.test.ts).
Pinning. Every third-party uses: is pinned to a full commit SHA with
the release in a comment (@<sha> # vX.Y.Z); Renovate bumps both. A bare
owner/action@ref resolves to github.com; a Gitea-hosted action needs its
full URL. The ops repository's workflows are pinned to the commit of an ops
tag — 8e6582af… # ops v2026.11.2 — by hand: Renovate reads no version
in # ops … and skips them. Tools downloaded by checksum (osv-scanner in
gates) are bumped by hand too, version and SHA-256 together.
Pinned as of 2026-11-24: actions/checkout v7.0.1 · pnpm/action-setup
v6.1.1 (no version: — it reads packageManager) · actions/setup-node
v7.1.0 (node-version-file: .nvmrc) · actions/cache v6.1.0 ·
christopherhx/gitea-upload-artifact v4 · lycheeverse/lychee-action
v2.9.0 · osv-scanner v2.7.1 (binary) · ops v2026.11.2 (security.yml,
reusable-qodana.yml, announce-release.yml).
2. The workflows
.gitea/workflows/ci.yml (CI) — self-contained, deliberately. It once
called poli0981/.github → reusable-web-react.yml, which ran lint /
typecheck / test only if a matching package script existed: rename a
script and CI silently stops checking while still going green. This
project's gates are the product, and it has shipped silent no-ops before (a
dead set:html lint rule, workbox globs matching nothing, an unregistered
service worker, CSP-dropped inline styles). The duplicated "logic" is a
handful of pnpm invocations. Triggers: pull_request, push to main,
workflow_dispatch (the bots, §4). Concurrency cancels superseded runs
except on main. Jobs:
build(30 min cap) — install (frozen lockfile) →pnpm lint(ESLint + Prettier) →pnpm check(types) →pnpm coverage(the unit run itself, failing below the thresholds invitest.config.ts) →pnpm build— the same command thedeployjob runs, carrying its own gates:validate:data → i18n:check → astro build → postbuild:html → check:csp → check:assets → check:sw → check:feed→wrangler deploy --dry-run(bundlesworker/and validateswrangler.jsonc— bindings, assets,run_worker_first— without credentials) →pnpm knip→ Playwright e2e on that build (docs/11 §5) —astro previewfor the pages,wrangler devfor the Worker and its rate limits; the Chromium download is cached per Playwright version (on a hit only the OS libraries are installed), and the HTML report is kept as an artifact when the job fails.gates(15 min cap) —validate:data,i18n:check, osv-scanner overpnpm-lock.yaml(the pinned, checksum-verified binary the opssecurity.ymluses;osv-scanner.tomlnext to the lockfile holds the time-boxed exceptions, docs/09 §7),pnpm audit --prod, and on PRs the changed-links lychee sweep (§5).record— only onworkflow_dispatch: recordsbuildandgatesas commit statuses (§1, fact 2). Cancelled or skipped jobs record nothing.deploy— only on a push tomain, afterbuildandgatespass (§3).
.gitea/workflows/security.yml (Security) — a caller of the ops
repository's security.yml with node: true, on pushes to main, PRs, a
weekly slot (37 15 * * 2) and dispatch. It replaced CodeQL, which Gitea
does not have:
- secrets — gitleaks over the whole history. Public identifiers it
would flag (the Turnstile site key, the Web Analytics token, test
fixtures) are listed in
.gitleaksignoreascommit:file:rule:line, each with its reason. A real secret never goes there: it is rotated. - sast — Opengrep with pinned community rules for JavaScript/TypeScript,
--taint-intrafile; report-only, the SARIF kept as an artifact. - deps — osv-scanner over every lockfile it finds; fails on a known vulnerability.
Not a required check: gates is the one that blocks a merge on an advisory.
.gitea/workflows/qodana.yml (Qodana, D35) — a caller of the ops
reusable-qodana.yml (the Qodana CLI 2026.3.1, pinned and checksum-
verified) with package-manager: pnpm, node-version-file: .nvmrc and
prepare-command: pnpm exec astro sync; secret QODANA_TOKEN (the Qodana
Cloud project token that carries the Ultimate licence qodana-js
needs). On PRs, pushes to main and dispatch; no schedule. Scope and gate
live in qodana.yaml:
- Native mode (
withinDocker: 'false'): the linter runs in the job's own container after the install, so it resolves imports against the real install on Node 26. - Profile
qodana.recommended; the dataset, build/test output and local tool state excluded.qodana-jsreads.ts/.js/.mjs, JSON, YAML, Markdown and CSS;.astroand.svelteare outside its language list. JetBrains' Astro and Svelte plugins were tried and dropped (2026-11-15): under Qodana their type checks were not deterministic (one commit flipped between 0 and 15 errors).astro check, ESLint, the Vitest island suites and e2e cover those files. - Gate:
failureConditions.severityThresholds.any: 0— any finding turns the job red. A false positive with a known cause is switched off inqodana.yaml, with its reason — never withnoinspectioncomments. - Findings live in Qodana Cloud (project
softharbor) and the run'sqodana-reportartifact; Gitea has no code-scanning UI, so the SARIF upload to GitHub code scanning went (D38). Runs started byrenovate-botskip the scan: Gitea gives same-repo PRs the secrets, and such a run installs the very update under review. - Not required: a Qodana Cloud outage or a lapsed licence must never block a merge. The licence runs until 2026-12-31 — renew it, or every run turns red from 2027-01-01. The Qodana Cloud project's VCS URL must name the Gitea repository (maintainer).
.gitea/workflows/notify.yml (published release → Discord) — a caller of the
ops announce-release.yml, pinned to the ops tag's commit, with ops_ref
set to the same SHA (the notifier script is loaded from that commit) and
only DISCORD_RELEASES_WEBHOOK passed — never secrets: inherit. It reads
the release from Gitea's API. Publish the release by hand in Gitea
(docs/13 §3): a release a workflow created with the job token would fire no
release: published event. Re-announce with Actions → notify → Run workflow
and the tag. Release notes go straight to Discord, so they must be final
before publishing.
Scope note. notify.yml fires once per tagged release and reaches
Discord only. The multi-platform notify.py cross-poster consumes
/rss.xml on its own schedule (docs/03 §7, docs/13 §5): per-app
announcements need no workflow here — only a valid, deterministic feed.
Removed with GitHub (D38): codeql.yml (→ security.yml), the sonar
job and sonar-project.properties (SonarQube Cloud dropped in every
repository of the owner, runbook D1 — Qodana and Opengrep cover the
analysis), the SARIF upload, .github/dependabot.yml (→ Renovate, §6), and
the "Allow GitHub Actions to create pull requests" setting the bots needed.
3. Deploy
ci.yml's deploy job is the only thing that deploys (D38). Cloudflare
Workers Builds pulled from the GitHub repository and stopped with it; it is
not reconnected to the GitLab mirror, which would deploy a second time on
every mirror push (runbook D3).
| Trigger | What happens |
|---|---|
push to main |
after build + gates pass: install → pnpm build → pnpm exec wrangler deploy --message "main <sha7>" — assets and the Worker — then poll https://softharbor.net/api/apps.json?deploy=<sha> until its generatedAt equals dist/api/apps.json's (30 × 5 s) |
| pull request | nothing — no preview versions |
CLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_IDare user-level Gitea Actions secrets (shared by the owner's Workers projects) and appear in thedeployjob only, which runs only for pushes tomain. Gitea gives same-repository PRs the secrets — Renovate's included — so no job a branch can run ever sees the token; that is also why PR previews went.- The token needs Workers Scripts → Edit on the account.
wrangler.jsoncdeclares no routes (docs/16 §3): the two custom domains are attached in the dashboard, and a deploy leaves them alone — so no zone scopes are needed. If a route orcustom_domainis ever declared, the token needs Zone → Workers Routes → Edit and Zone → DNS → Edit too (a localwrangler deployuses OAuth with full rights and will not reveal the gap). - The Worker's runtime secret
TURNSTILE_SECRETlives on the Worker and survives every deploy. Build-time variables do not exist: the build reads no environment. - Verify after the job (docs/13 §3): the job already waits for the new
build; spot-check the response headers,
/api/verifyanswering JSON,/rss.xml, and the hashed/_astro/names (builds are not byte-identical: eachastro-islandcarries a randomuid). - Rollback: dashboard → the Worker → Deployments → promote a previous
version, or
wrangler rollbacklocally. A localpnpm deploystill works for the maintainer but bypasses CI; prefer reverting onmain. preview_urlsstaystrueinwrangler.jsonc, and_headersstill marks*.workers.devhostsnoindex: a hand-madewrangler versions uploadremains possible, but nothing makes one.
4. Quarantine workflow (repo-local)
.gitea/workflows/quarantine.yml — enforces hard rule 5 mechanically. On
data pushes to main, daily at 13:17 UTC (was 02:17 on GitHub) and on
dispatch; concurrency: quarantine. The job (contents, pull-requests,
issues, actions: write):
node scripts/quarantine.mjs(alsopnpm quarantine, for the maintainer): scanssrc/data/apps/*.jsonand moves eachstatus === 'flagged'file todata/quarantine/(a rename; the directory is created on first use). It skips unparseable files (L1/L2's job), refuses a non-slug filename, never overwrites a quarantined copy and emits themovedoutput (space-separated slugs). Idempotent.- If anything moved: commit to
quarantine/autoas SoftHarbor bot (actions@noreply.git.poli0981.dev) and force-push it with the job token (anAUTHORIZATION: basicextra header, the wayactions/checkoutpersists credentials — but only for this push, never while repository code runs). gitea.mjs propens — or updates — the PRquarantine/auto→main(labelssecurity,quarantine),gitea.mjs dispatchrunsci.ymlandsecurity.ymlon the branch, andgitea.mjs quarantine-issuesopens[quarantine] <slug>for each slug that has no open issue yet.
The PR (not a direct push) keeps a human in the loop on main, while the
daily run guarantees a flagged entry does not outlive the next evening even
if a reviewer missed it. Normally it never fires: validate:data fails a PR
that flags an entry without moving it. Step outputs reach shell bodies only
through env:, never ${{ }} inside run:; gitea.mjs validates slugs
before they reach an issue title.
The bot's commits are unsigned — Gitea has no API that signs a commit for the job token — which is why branch protection does not require signed commits (§8). A label that does not exist on the repository is left off with a notice (Gitea's API attaches labels by id and creates none).
4b. VirusTotal re-check (repo-local)
.gitea/workflows/vt-recheck.yml + scripts/vt-recheck.mjs (added
2026-10-23, D30) — docs/09 §6 step 5 made assisted, so no dated security
claim can go stale unnoticed.
- What it scans: each entry's
links.downloadpage.POST /urlssubmits it, a second pass readsGET /analyses/{id}, and the permalink ishttps://www.virustotal.com/gui/url/<sha256>. The canonical form keeps a#fragment: the API puts it in the id (measured 2026-10-23), while a scan submitted from a browser never sends one. - What it writes: only the three
securitylines, patched in place so Prettier's layout survives; neveraddedAt/updatedAt— the feed orders byaddedAt, and notify.py announces anything it has not seen. - The rules: zero malicious/suspicious ⇒ fresh
evidence+checkedAt, status unchanged; any detection ⇒cleanbecomesunverifiedand a[vt] <slug>issue (labelsecurity) asks the maintainer to decide;promoteslugs gounverified→cleanonly on a clean scan. It never setsflagged— quarantine stays a humanpnpm quarantine(§4). An analysis in which no engine answered is "not checked", not clean. - Who is due: the
slugsinput first, then never-scanned entries, then drifted evidence (at most weekly), then checks older thanmax_age(default 90 days), oldest first. - Limits: the Public API allows 4 requests a minute and 500 a day
(reset at 00:00 UTC), and counts every call. The script paces at 15.5 s,
spends at most
budget(default 440, capped at 500) with no more than half of it on submissions, backs off 60 s once on a 429 and treats a second as the day's quota — keeping what it finished. A refused key fails the step; a missing key is a no-op that says so.concurrency: vt-recheckkeeps two runs off one key. Daily at 13:59 UTC (was 00:41 on GitHub, right after the reset; any hour fits one run's 440 requests). - On
main(daily cron, or dispatch): one PR,vt/recheck. While it is open (gitea.mjs pr-open), each run first carries its results (git archiveof the branch into$RUNNER_TEMP; a block is adopted only if its download link is unchanged and its check is newer), so the PR accumulates day by day. Then it commitssrc/data/appstovt/recheckand force-pushes — only if the tree differs from the branch's, since the carried results alone makechangednon-zero every day — opens or updates the PR, dispatchesci.ymlandsecurity.ymlon it, and opens[vt] <slug>issues (gitea.mjs vt-issues). Merged branches are deleted, and a PR closed unmerged is never carried. - On any other branch (preview): dispatch it on the data branch (Actions
→ vt-recheck → Run workflow → the branch) and it scans only the
slugsgiven — or, with none, the entries without a scan, i.e. a data PR's new apps. It prints the diff of the patchedsecurityblocks in the log (readable without signing in to download anything) and keeps the files and the report as thevt-previewartifact (7 days). No PR, no issues: the maintainer copies only thesecurityblocks into the data PR — a whole file from the dispatch commit would revert later edits. - Terms: VirusTotal offers the Public API to sites "free to consumers"; it "must not be used in business workflows that do not contribute new files" and "can not be used as a substitute for antivirus products". SoftHarbor is free, carries no ads and only submits public download URLs; the site copy keeps making no safety claim (hard rule 4).
5. Link check (repo-local)
.gitea/workflows/link-check.yml — the weekly full sweep, Monday 14:43
UTC (was 04:43): scripts/extract-urls.mjs lists every links.* and
evidence URL, lychee checks them (--max-concurrency 4 --retry-wait-time 10 --max-retries 5 --timeout 45 --accept '200..=299,403,429', fail: false),
and gitea.mjs link-rot keeps one tracking issue, link-check: broken official links (label link-rot): replaced with the new report and a
comment linking the run while the sweep fails, opened on the first failure,
closed the first week it comes back clean. On GitHub an earlier version
opened a fresh issue on every red run and left 12 duplicates open.
403 and 429 count as reachable in both sweeps (decision of 2026-07-30,
docs/15 §4): 14 of the first 26 failures were bot mitigation on plainly
live vendor sites. 404/5xx/connection failures still fail. Do not add
--user-agent: spoofing a browser cleared the 403s but made other vendors
answer 406/400.
PR-time link checking covers only the links the PR adds or edits — the URLs
on the added lines of its diff. It runs as the last two steps of ci.yml's
gates job (§2): git diff -U0 runs under set -euo pipefail and pipes
into extract-urls.mjs --added (a failed diff stops the job rather than
silently narrowing the check), and lychee is skipped when there is
nothing to check — an empty input is a configuration error to lychee, and a
skipped step stays visible where a green "0 links" would not. Changed
2026-10-23: it used to check every link of every touched file, and the
first vt/recheck PR — 198 rewritten security blocks — failed three times
on ~700 unrelated vendor links.
6. Dependency & scanning automation
Renovate (D38) replaces Dependabot: the owner's self-hosted Renovate runs
from poli0981/renovate-config daily at 13:31 UTC over every repository the
renovate-bot user can write to. renovate.json extends the shared preset
(local>poli0981/renovate-config):
| What the preset does | |
|---|---|
| base | config:recommended, the Dependency Dashboard issue |
| actions | every uses: pinned to a SHA with its version comment, looked up over git (git ls-remote) — there is no github.com token |
| grouping | all minor + patch updates in one PR; majors separate |
| age | a new npm release is proposed only once it is 3 days old — which also keeps pnpm 11's own 24 h minimumReleaseAge from failing a release-day update at pnpm install --frozen-lockfile |
| security | OSV advisories open their own PRs (labels dependencies + security) without the age wait; the dashboard lists the open ones |
This repository adds three rules: no majors for typescript /
@typescript/native (D21 as amended — the TS 6 API wrapper and TS 7 run side
by side), for node / @types/node (the typings track the Node major in
.nvmrc, docs/01 §5 rule 4) and for pnpm (11.x by decision). Those are
platform moves, made deliberately. No schedule here: the runner's cron is
the schedule. The ops pins (# ops v…) and the osv-scanner binary are bumped
by hand. Maintainer setup (once): renovate-bot as a Write collaborator and
the labels dependencies + security (maintainer/gitea-repo-setup.ps1 in
the ops repository; both labels exist since 2026-11-23).
Scanning: osv-scanner and pnpm audit --prod in gates (required, every PR
and push), the ops security.yml (gitleaks, Opengrep, osv-scanner) and
Qodana. A finding in gates fails the job (policy docs/01 §5).
7. Issue templates
Two sets, kept in step:
.gitlab/issue_templates/— what the public uses, on the GitLab mirror:Bug.md,App request.md,Listing change.md,Accessibility.md, and.gitlab/merge_request_templates/Default.md. Each ends with a/label ~…quick action (applied when the maintainer edits the issue). GitLab reads no issue forms, so these are Markdown with checklists..github/ISSUE_TEMPLATE/*.yml+.github/PULL_REQUEST_TEMPLATE.md— the forms Gitea reads (it reads.gitea/ISSUE_TEMPLATE,.github/ISSUE_TEMPLATEand.github/issue_template); only the maintainer can open issues there.
Bug.md is the layout the site's Report a bug link fills in
(src/lib/issueUrl.ts, docs/05 §A6): ### Page URL, ### What happened / expected, ### Browser & OS, ### Console output. Change one with the
other. Until 2026-11-24 the GitHub form's field ids (page-url,
environment, console-output) were the prefill query parameters.
The Accessibility template (D33) asks only what got in the way and the
page address; steps, environment, a severity (Critical / Serious / Moderate
/ Minor — confirmed in triage) and a screenshot are optional; it names the
e-mail route accessibility@poli0981.dev (no account needed) and never asks
about disability. Listing change (D36): which app, what should change
(remove / correct a link / correct a detail / re-check), the evidence; it
sends a suspected malicious download to security@ by e-mail and a
developer to takedown@. .github/ISSUE_TEMPLATE/config.yml: blank issues
off; contact links to code@ (questions), the Accessibility statement and
SECURITY.md (e-mail only).
The PR template (v1.4; v1.4.1 adds the D36 box): what and why with the
linked issue, the CI gates, docs and i18n parity, the accessibility
checklist and a data-PR block (docs/00 §3, docs/09 §6, original EN/VI
summaries, unverified entry, official links).
8. Branch protection (Gitea, main)
Gitea branch protection on main (D6 in the runbook; set by the maintainer
in Settings → Branches):
- Changes arrive by pull request; pushing to
mainis the owner's only; no force push, no deletion; 0 required approvals (single-maintainer repository —.gitea/CODEOWNERSonly requests the review). - Required status checks: the patterns
CI / build (*)andCI / gates (*). Gitea names a check<workflow> / <job> (<event>), so the(*)matches thepull_request,pushandworkflow_dispatchruns alike — the last written byrecord(§1). Renaming the workflow (CI) or a job breaks the rule until it follows.SecurityandQodanaare not required: an outside service's outage must never block a merge. - Signed commits are not required: the bots' commits cannot be signed
(§4). The maintainer's own commits are still GPG-signed locally, and Gitea
verifies them against the key on the account
(
https://git.poli0981.dev/poli0981.gpg). - Merge method: squash. The squash title must be a valid conventional
commit, and the body should carry every commit subject from the branch
(docs/10 §5). A branch stacked on a squashed one is replayed with
git rebase --onto origin/main <old-branch>.
.gitea/CODEOWNERS (Gitea reads it from the root, docs/ or .gitea/
only, and treats each pattern as a regular expression): .* plus the
high-risk paths ^\.gitea/, ^scripts/, ^src/data/, ^worker/ (T6).
Until 2026-11-24 this was GitHub's ruleset "Run" (PR, signed commits,
linear history, checks build, gates, codeql / Analyze (javascript-typescript)).