Files
poli0981andClaude Opus 5.5 826c9e65d5
Ops lint / actionlint + Python (pull_request) Successful in 6s
Ops lint / actionlint + Python (push) Successful in 6s
docs(migration): RepoLens's private mirror, report token and webhook
RepoLens's GitLab push mirror (2026-11-27) was created public, which
exposed the private source and LICENSE's internal note; it is private
now. The guide says so, with the lesson for other private repos: check
the mirror's visibility right after creating it. It also records the
report token (Guest role drops labels, expires 2027-11-26), the live
system webhook and how its first deliveries were checked (no Test
Delivery for system hooks), and which maintainer steps remain. The
tracker marks the mirror.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 09:21:12 +07:00

9.7 KiB
Raw Permalink Blame History

RepoLens — migration guide

Written 2026-11-23 against main @ ed91e72 (local clone E:\repo, Gitea poli0981/repolens). Profile: SvelteKit 3 on one Cloudflare Worker (repolens.poli0981.dev), a showcase of the maintainer's repositories read from the GitHub API, with a Cron Trigger (*/10 * * * *) that warms the cache. Maintenance mode since v1.5.0. Shared decisions: README.

Done 2026-11-26. The migration merged as Gitea #2 (fast-forward to 35b5926, 9 commits: CI, Renovate, RL1–RL4, templates, docs), the CI deploy job put it live (version 475c73d8, custom domain and the */10 cron applied), and v1.6.0 followed with the dependency refresh (Gitea #3, #4). The site reads Gitea again: 24 public repos, the production smoke 7/7. Renovate's onboarding PR #1 was closed (#2 adds renovate.json). What the move found:

  • The repository went private on Gitea (the owner's choice: LICENSE carries an internal relicensing note that must not be public). Outside contributions arrive by e-mail. Renovate and the runner keep working (renovate-bot is a collaborator). Its GitLab push mirror (added 2026-11-27, also where the confidential bug reports land) was created public, which exposed the private source and that note; it was switched to private the same day. For a private Gitea repo, check the mirror's visibility right after creating it.
  • Anonymous reads (D13) settled the VERIFY items: GET /repos/{o}/{r}/licenses answers (the list and repo objects carry licenses too, which can include README); GET …/actions/runs answers 401 without a token, so the build badge reads the head commit's statuses (GET …/commits/{sha}/status, anonymous, one per job, latest per context, target_url relative). GET …/actions/tasks is anonymous as well.
  • No ETag, no rate-limit headers (Cache-Control: max-age=0, private on every answer). RepoLens keeps each sub-resource with a validator instead: the repo's updated_at (any push moves it, Renovate's branches included) or the head sha. A quiet list refresh is one request; a cold one 1 + 4 per repo.
  • No pushed_at: the default branch's head commit time is the last push. Times carry the committer's offset (+07:00): normalise to UTC before comparing ISO strings. Stars and forks are always 0 without registration (hidden), and there are no deployments or language colours.
  • Webhook (RL3): Gitea signs with X-Gitea-Signature (hex HMAC-SHA256, no prefix) and also sends GitHub-style headers (read from services/webhook/deliver.go). The system webhook form (Site Administration → Integrations → Webhooks → System Webhooks) names the events Create, Delete, Push, Repository, Release, Statuses and Workflow Run. Gitea sends no ping, rename, transfer or visibility events.
  • Bug reports (RL2, D14): GITLAB_TOKEN_ISSUES is optional on purpose: without it the endpoint answers 503 and the dialog offers code@ (no deploy waits on a GitLab token). The token set on 2026-11-26 has the Guest role: GitLab files a Guest's confidential issue but silently drops its labels, so Reporter is the role to pick. It expires 2027-11-26 (RepoLens docs/11 §H).
  • System webhook (live 2026-11-27, admin hook #1): system hooks have no Test Delivery button, so the first real events checked it (npx wrangler tail repolens --format json --search webhook): a push and two commit statuses of free-games-itchio-list answered 202, refreshed the list and the detail in ~2.5 s with 13 requests, and the burst's later deliveries rode along.
  • e2e in the job container: binding wrangler dev and Playwright to 127.0.0.1 (runbook §6) was enough; chromium and webkit both ran. One PR's CI took ~10 minutes on the single runner (verify 55 s, e2e 2 min 44 s, Qodana 2 min 48 s).
  • Merging in the UI: "Fast-forward only" keeps the signed commits; a UI merge commit is unsigned. Until #2 merged, main's GitHub-era maintenance-triage.yml still ran on the PR (pull_request_target reads the base branch).
  • Branch protection (D6): no push, no force push; required CI / verify (*), CI / e2e (*), Security / npm-audit (*), Reusable / Security / Secrets (gitleaks) (*), Reusable / Security / Dependencies (osv-scanner) (*).
  • adapter-cloudflare 9 builds through @cloudflare/vite-plugin and refuses a main in wrangler.jsonc: RepoLens's withScheduled cron entry needs a redesign before it can move (left on 8.0.3). Other SvelteKit Workers with a Cron Trigger will meet the same wall.
  • On the PC: GPG signing failed with "sending fd … to keyboxd" until gpgconf --kill keyboxd of Gpg4win (git's gpg.program), not Git Bash's gpgconf.
  • Done by the maintainer by 2026-11-27: the GitLab project + GITLAB_TOKEN_ISSUES, the system webhook + GITEA_WEBHOOK_SECRET, the dead GITHUB_* Worker secrets deleted. Still open: disconnecting Workers Builds, Qodana Cloud's VCS URL, and every repo's description/website/topics on Gitea (all empty after the import; RepoLens shows them once set).

Before the move: the site had no data source. Every repo it showed came from GitHub's GraphQL API with GITHUB_TOKEN_READ, a token of the suspended account; bug reports opened GitHub issues with GITHUB_TOKEN_ISSUES; the webhook was GitHub's. Restoring it is a website incident, which maintenance mode takes.

Decided (2026-11-23)

  • RL1 — the data source moves to the Gitea REST API, without a token (D13). src/lib/server/github.ts keeps its normalised shapes and changes what fills them:

    Today (GraphQL / REST on github.com) Gitea
    repository list GET /users/poli0981/repos (paged, limit ≤ 50)
    stars, forks, homepage, pushed, open issues and PRs, default branch, visibility GET /repos/{owner}/{repo} (stars_count, forks_count, website, updated_at, open_issues_count, open_pr_counter, default_branch, private)
    topics, languages /topics, /languages
    commits, tags, releases /commits?sha=<default>&limit=…, /tags, /releases
    licence /licenses (VERIFY on 28.4.0), else the LICENSE file's first line
    the newest push's Actions runs /actions/runs (VERIFY, README gh table)
    deployments none on Gitea: the deploy line goes

    Stars and forks read 0 on an instance without registration: hide the two counters rather than show zeros. Fixtures in tests/fixtures/gh/ are replaced with recorded Gitea answers; the unit tests keep faking ghFetch (rename it if the session likes). src/params.ts' guard against odd repo names stays. The cache, the warm cron and the rate limits stay as they are; Gitea has no GraphQL points, so docs/05's points budget becomes a request budget.

  • RL2 — bug reports go to GitLab (D14). src/lib/server/issues.ts creates the issue on gitlab.com/poli0981/repolens (preview hosts stay a dry run). GITHUB_TOKEN_ISSUES → GITLAB_TOKEN_ISSUES.

  • RL3 — the webhook. Gitea sends X-Gitea-Event and X-Gitea-Signature (hex HMAC-SHA256 of the body, VERIFY on 28.4.0). One system webhook (Site Administration → Webhooks) covers every repo instead of one per repo; webhook.ts verifies the new header and maps Gitea's push / release / repository events onto the same eviction plans. GITHUB_WEBHOOK_SECRET → GITEA_WEBHOOK_SECRET (still opt-in, still outside secrets.required).

  • RL4 — legal. The privacy text changes where report data goes (GitLab instead of GitHub) and where repo data comes from: a material change. Edit legal/*.md in ONE commit, run npm run build:legal, bump LEGAL_VERSION.

  • Order: the CI move first, then RL1–RL4 as their own commits on the same branch; the first deploy (D3) ships them together.

  • D2 (maintenance-triage.yml goes), D3 (deploy job with wrangler deploy: Cron Triggers apply only on wrangler deploy, never on versions upload), D6 (.github/rulesets/main.json goes; branch protection names the new check names), D7.

Workflows (.github/workflows → .gitea/workflows)

File Do
ci.yml (verify, Sonar, e2e with a GitHub read token, upstream artifact actions) Move; Gitea artifact actions; remove Sonar (D1); the e2e run needs no GitHub token after RL1. Add the deploy job on main (D3)
e2e.yml (production smoke, 0 4 * * *) Move; cron → 11 13 * * *
security.yml (osv-scanner, npm-audit, gitleaks, Snyk; 0 6 * * 1) osv-scanner and gitleaks → the ops security.yml caller (node: true), cron 33 14 * * 2; npm-audit and Snyk stay local, Snyk pinned by SHA
qodana.yml Caller of reusable-qodana.yml (package-manager: npm)
codeql.yml (dispatch-only caller of reusable-codeql.yml@main) Delete
dependabot-automerge.yml Delete: Renovate's automerge rules live in renovate-config
maintenance-triage.yml Delete (D2)

.github/dependabot.yml → delete; add renovate.json (the typescript 6 / @typescript/native 7 pair stays manual, as CLAUDE.md says).

README.md (8), MAINTAINERS.md, CONTRIBUTING.md, ACCESSIBILITY.md (+ legal/ACCESSIBILITY.md), legal/THIRD_PARTY_NOTICES.md, src/lib/legal/content.ts (generated: edit legal/*.md), .github/ISSUE_TEMPLATE/config.yml, docs/02, 05, 10 and 11, .dev.vars.example, wrangler.jsonc (secrets.required), CLAUDE.md (data source, landmines, deploys), and the UI copy that says "GitHub" (EN and VI). CHANGELOG.md is history.

Secrets

Actions: keep QODANA_TOKEN, SNYK_TOKEN. Create (user level): CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID. Drop SONAR_TOKEN and the explicit GITHUB_TOKEN. Worker: remove GITHUB_TOKEN_READ; GITHUB_TOKEN_ISSUES → GITLAB_TOKEN_ISSUES (D14); GITHUB_WEBHOOK_SECRET → GITEA_WEBHOOK_SECRET.