From f70468e995c3b13dc4add907426eb6e32fcfd807 Mon Sep 17 00:00:00 2001 From: poli0981 Date: Mon, 23 Nov 2026 17:50:34 +0700 Subject: [PATCH 1/7] ci: reusable Qodana scan with the Qodana CLI reusable-qodana.yml replaces JetBrains/qodana-action, which needs GitHub's APIs, for every stack: CLI 2026.3.1 pinned and SHA-256 verified (Linux tarball, Windows zip), native mode by default, report kept as an artifact since Gitea has no code-scanning UI. Inputs cover what the repos' own Qodana jobs do: Node install with scripts off, a prepare command (astro sync, wxt prepare), .NET from a version or global.json, a config file per Qodana Cloud project, and within-docker for qodana-rust, which has no native mode. Runs started by renovate-bot skip the job, as the pilot's does. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MnPQKxkPgL2sb8BqwHKv5k --- .gitea/workflows/reusable-qodana.yml | 241 +++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 .gitea/workflows/reusable-qodana.yml diff --git a/.gitea/workflows/reusable-qodana.yml b/.gitea/workflows/reusable-qodana.yml new file mode 100644 index 0000000..13f2a2e --- /dev/null +++ b/.gitea/workflows/reusable-qodana.yml @@ -0,0 +1,241 @@ +# Reusable Qodana scan with the Qodana CLI (runbook §3.5). Replaces JetBrains/qodana-action, +# which needs GitHub's APIs. Gitea has no code-scanning UI, so the findings live in Qodana Cloud +# and in the `qodana-report` artifact (SARIF + HTML report). +# +# Lives in poli0981/.github (Gitea) → called via: +# on: +# push: +# branches: [main] +# pull_request: +# workflow_dispatch: +# schedule: +# - cron: ' <13-15> * * ' # weekly, inside 13:00–16:00 UTC, a FREE slot (runbook §8) +# permissions: +# contents: read +# jobs: +# qodana: +# uses: poli0981/.github/.gitea/workflows/reusable-qodana.yml@ # ops vYYYY.MM.N +# with: +# package-manager: pnpm # JS/TS: qodana-js reads the dependencies' types +# prepare-command: pnpm exec astro sync +# secrets: +# QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} +# +# .NET whose solution targets net*-windows (WPF): `runs-on: windows-latest` and +# `dotnet-version: 10.0.x` → native mode in HOST MODE on the maintainer PC (runbook §3.5). +# Two Qodana Cloud projects in one repo (e.g. Rust + TS): call this twice with `config`, +# `artifact-name` and each project's token. +# +# How it runs: +# - Native mode by default (`--within-docker false`): on ubuntu-latest the job already is a +# container. A linter without a native mode (qodana-rust) needs `within-docker: true`, +# best on windows-latest, where Docker Desktop on the maintainer PC runs the Linux image +# (VERIFY on pilot; on ubuntu-latest it would need the runner to hand the job a Docker socket). +# - The linter comes from qodana.yaml (`linter:`) unless `linter` is set. +# - Runs started by renovate-bot (push or pull request) skip the job: Gitea gives same-repo +# pull requests the repo's secrets, and such a run installs the very update under review. +# Dependencies are installed with lifecycle scripts off. +# - The CLI is downloaded at a pinned version and SHA-256 verified (JetBrains publishes both +# in qodana-action's common/cli.json). Renovate does not update it: bump the version and +# both checksums together, by hand. +# - Results go to the runner's temp dir. On Linux the cache does too (the container is +# thrown away); on the Windows host the CLI keeps its default per-user cache, so the +# linter is not downloaded again on every run. +# VERIFY on pilot: native mode of each linter on its runner (ticktune runs qodana-js this way). + +name: Reusable / Qodana + +on: + workflow_call: + inputs: + runs-on: + description: "'ubuntu-latest' (Docker) | 'windows-latest' (host mode; needed for net*-windows)" + type: string + default: 'ubuntu-latest' + linter: + description: "Linter (e.g. qodana-js, qodana-dotnet, qodana-python); empty = qodana.yaml's `linter:`" + type: string + default: '' + config: + description: 'Qodana config file (empty = qodana.yaml in the project dir)' + type: string + default: '' + project-dir: + description: 'Directory to analyse (empty = repo root)' + type: string + default: '' + package-manager: + description: "'none' | 'npm' | 'pnpm': install Node dependencies (scripts off) before the scan" + type: string + default: 'none' + node-version: + description: 'Node.js version, used when node-version-file is empty' + type: string + default: '24' + node-version-file: + description: 'File with the Node.js version (e.g. .nvmrc); wins over node-version' + type: string + default: '' + dotnet-version: + description: '.NET SDK to install (empty = none)' + type: string + default: '' + dotnet-global-json-file: + description: 'global.json that pins the .NET SDK (wins over dotnet-version)' + type: string + default: '' + within-docker: + description: 'true = run the linter image in Docker (for linters with no native mode, e.g. qodana-rust)' + type: boolean + default: false + prepare-command: + description: 'One command run after the install, in the runner shell (bash on Linux, pwsh on Windows)' + type: string + default: '' + artifact-name: + type: string + default: 'qodana-report' + secrets: + QODANA_TOKEN: + required: true + +permissions: + contents: read + +jobs: + scan: + name: Qodana + # Same check for push and pull_request runs (github.event.pull_request is empty on a push). + if: ${{ github.actor != 'renovate-bot' && github.event.pull_request.user.login != 'renovate-bot' }} + runs-on: ${{ inputs.runs-on }} + timeout-minutes: 45 + permissions: + contents: read + env: + QODANA_CLI_VERSION: 2026.3.1 + QODANA_CLI_SHA256_LINUX: dae6d31f481ed15c6c016fd746e907978f0c1437010326fa04a92f13c7c52338 # qodana_linux_x86_64.tar.gz + QODANA_CLI_SHA256_WINDOWS: 33ed647c79468c68c016e72ce7f3f9483278143f5e5199da1d6159c2f5594ba2 # qodana_windows_x86_64.zip + QODANA_ENDPOINT: 'https://qodana.cloud' + LINTER: ${{ inputs.linter }} + CONFIG: ${{ inputs.config }} + PROJECT_DIR: ${{ inputs.project-dir }} + WITHIN_DOCKER: ${{ inputs.within-docker }} + DOTNET_CLI_TELEMETRY_OPTOUT: '1' + DOTNET_NOLOGO: '1' + steps: + - name: Checkout (full history, for Qodana's blame and contributor count) + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Keep .NET SDK installs in the runner tool cache (Windows host mode) + if: ${{ (inputs.dotnet-version != '' || inputs.dotnet-global-json-file != '') && runner.os == 'Windows' }} + shell: pwsh + run: | + $base = if ($env:RUNNER_TOOL_CACHE) { $env:RUNNER_TOOL_CACHE } else { Join-Path $env:LOCALAPPDATA 'gitea-runner\toolcache' } + "DOTNET_INSTALL_DIR=$(Join-Path $base 'dotnet')" >> $env:GITHUB_ENV + + - name: Setup .NET + if: ${{ inputs.dotnet-version != '' || inputs.dotnet-global-json-file != '' }} + uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0 + with: + dotnet-version: ${{ inputs.dotnet-global-json-file == '' && inputs.dotnet-version || '' }} + global-json-file: ${{ inputs.dotnet-global-json-file }} + + - name: Setup pnpm + if: ${{ inputs.package-manager == 'pnpm' }} + uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1 + + - name: Setup Node.js + if: ${{ inputs.package-manager != 'none' }} + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: ${{ inputs.node-version-file == '' && inputs.node-version || '' }} + node-version-file: ${{ inputs.node-version-file }} + cache: ${{ inputs.package-manager }} + + # --ignore-scripts: no dependency runs code at install time in a job that holds a token. + # The analysis needs the packages' types, not their builds. + - name: Install dependencies (scripts off) + if: ${{ inputs.package-manager != 'none' }} + run: ${{ inputs.package-manager == 'pnpm' && 'pnpm install --frozen-lockfile --ignore-scripts' || 'npm ci --ignore-scripts' }} + + - name: Prepare + if: ${{ inputs.prepare-command != '' }} + run: ${{ inputs.prepare-command }} + + # ---------------- Linux (Docker) ---------------- + - name: Install the Qodana CLI (Linux) + if: ${{ runner.os != 'Windows' }} + shell: bash + run: | + set -euo pipefail + tmp="${RUNNER_TEMP:-/tmp}" + tgz="$tmp/qodana.tar.gz" + curl -fsSL --retry 3 -o "$tgz" \ + "https://github.com/JetBrains/qodana-cli/releases/download/v${QODANA_CLI_VERSION}/qodana_linux_x86_64.tar.gz" + echo "${QODANA_CLI_SHA256_LINUX} $tgz" | sha256sum -c - + mkdir -p "$tmp/qodana-cli" + tar -xzf "$tgz" -C "$tmp/qodana-cli" qodana + echo "$tmp/qodana-cli" >> "$GITHUB_PATH" + + - name: Qodana scan (Linux) + if: ${{ runner.os != 'Windows' }} + shell: bash + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} + run: | + set -euo pipefail + if [ -z "$QODANA_TOKEN" ]; then echo "::error::QODANA_TOKEN was not passed"; exit 1; fi + tmp="${RUNNER_TEMP:-/tmp}" + args=(scan --within-docker "$WITHIN_DOCKER" --results-dir "$tmp/qodana/results" --cache-dir "$tmp/qodana/cache") + if [ -n "$LINTER" ]; then args+=(--linter "$LINTER"); fi + if [ -n "$CONFIG" ]; then args+=(--config "$CONFIG"); fi + if [ -n "$PROJECT_DIR" ]; then args+=(--project-dir "$PROJECT_DIR"); fi + qodana --version + qodana "${args[@]}" + + # ---------------- Windows (host mode, PowerShell) ---------------- + - name: Install the Qodana CLI (Windows) + if: ${{ runner.os == 'Windows' }} + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + $ProgressPreference = 'SilentlyContinue' + $tmp = if ($env:RUNNER_TEMP) { $env:RUNNER_TEMP } else { [IO.Path]::GetTempPath() } + $zip = Join-Path $tmp 'qodana.zip' + Invoke-WebRequest -UseBasicParsing -OutFile $zip ` + -Uri "https://github.com/JetBrains/qodana-cli/releases/download/v$($env:QODANA_CLI_VERSION)/qodana_windows_x86_64.zip" + $hash = (Get-FileHash -Algorithm SHA256 -LiteralPath $zip).Hash.ToLowerInvariant() + if ($hash -ne $env:QODANA_CLI_SHA256_WINDOWS) { Write-Host "::error::Qodana CLI checksum mismatch: $hash"; exit 1 } + $dest = Join-Path $tmp 'qodana-cli' + Expand-Archive -LiteralPath $zip -DestinationPath $dest -Force + $dest >> $env:GITHUB_PATH + + - name: Qodana scan (Windows) + if: ${{ runner.os == 'Windows' }} + shell: pwsh + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} + run: | + if (-not $env:QODANA_TOKEN) { Write-Host '::error::QODANA_TOKEN was not passed'; exit 1 } + $tmp = if ($env:RUNNER_TEMP) { $env:RUNNER_TEMP } else { [IO.Path]::GetTempPath() } + $scanArgs = @('scan', '--within-docker', $env:WITHIN_DOCKER, '--results-dir', (Join-Path $tmp 'qodana\results')) + if ($env:LINTER) { $scanArgs += @('--linter', $env:LINTER) } + if ($env:CONFIG) { $scanArgs += @('--config', $env:CONFIG) } + if ($env:PROJECT_DIR) { $scanArgs += @('--project-dir', $env:PROJECT_DIR) } + qodana --version + & qodana @scanArgs + exit $LASTEXITCODE + + # !cancelled(), not the implicit success(): a scan that FINDS something fails, and those + # are exactly the findings the report must keep. + - name: Keep the report + if: ${{ !cancelled() }} + uses: christopherhx/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 # v4 + with: + name: ${{ inputs.artifact-name }} + path: ${{ runner.temp }}/qodana/results/ + if-no-files-found: ignore + retention-days: 14 -- 2.54.1 From cd34ce42c787ac3e9149a2bf4d12f371d700fd5e Mon Sep 17 00:00:00 2001 From: poli0981 Date: Mon, 23 Nov 2026 17:50:34 +0700 Subject: [PATCH 2/7] ci: lint the ops workflows before callers pin them ops-lint.yml runs actionlint 1.7.12 with shellcheck 0.11.0 (both pinned, SHA-256 verified) over .gitea/workflows, and compiles the Python. .github/actionlint.yaml ignores only what actionlint does not know about Gitea: the releases scope, full-URL actions, and the switched-off macOS workflow. All 21 workflows pass. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MnPQKxkPgL2sb8BqwHKv5k --- .gitea/workflows/ops-lint.yml | 69 +++++++++++++++++++++++++++++++++++ .github/actionlint.yaml | 14 +++++++ 2 files changed, 83 insertions(+) create mode 100644 .gitea/workflows/ops-lint.yml create mode 100644 .github/actionlint.yaml diff --git a/.gitea/workflows/ops-lint.yml b/.gitea/workflows/ops-lint.yml new file mode 100644 index 0000000..872d062 --- /dev/null +++ b/.gitea/workflows/ops-lint.yml @@ -0,0 +1,69 @@ +# Self-check for the ops repo: the workflows here are linted before any caller pins them +# (runbook §4.1). +# - actionlint, with shellcheck on every `run:` script. .github/actionlint.yaml ignores only +# the Gitea features actionlint does not know (the `releases` scope, full-URL actions, the +# switched-off macOS workflow). +# - Python syntax of the notifier script and the tools. +# Both tools are downloaded at pinned versions and SHA-256 verified. Renovate does not update +# them (they are not actions): bump version and checksum together, by hand. + +name: Ops lint + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ops-lint-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: actionlint + Python + runs-on: ubuntu-latest # Gitea: Docker, docker.gitea.com/runner-images + timeout-minutes: 10 + permissions: + contents: read + env: + ACTIONLINT_VERSION: 1.7.12 + ACTIONLINT_SHA256: 8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 # actionlint_1.7.12_linux_amd64.tar.gz (release checksums file) + SHELLCHECK_VERSION: v0.11.0 + SHELLCHECK_SHA256: 8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198 # shellcheck-v0.11.0.linux.x86_64.tar.xz (no checksums file upstream; hashed 2026-11-23) + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install actionlint ${{ env.ACTIONLINT_VERSION }} + shellcheck ${{ env.SHELLCHECK_VERSION }} + run: | + set -euo pipefail + tmp="${RUNNER_TEMP:-/tmp}" + bin="$tmp/lint-bin" + mkdir -p "$bin" + curl -fsSL --retry 3 -o "$tmp/actionlint.tar.gz" \ + "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" + echo "${ACTIONLINT_SHA256} $tmp/actionlint.tar.gz" | sha256sum -c - + tar -xzf "$tmp/actionlint.tar.gz" -C "$bin" actionlint + curl -fsSL --retry 3 -o "$tmp/shellcheck.tar.xz" \ + "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" + echo "${SHELLCHECK_SHA256} $tmp/shellcheck.tar.xz" | sha256sum -c - + tar -xJf "$tmp/shellcheck.tar.xz" -C "$bin" --strip-components=1 "shellcheck-${SHELLCHECK_VERSION}/shellcheck" + echo "$bin" >> "$GITHUB_PATH" + + - name: actionlint + run: | + actionlint -version + shellcheck --version | sed -n 2p + actionlint -color -config-file .github/actionlint.yaml \ + -shellcheck "$(command -v shellcheck)" .gitea/workflows/*.yml + + - name: Python syntax + run: | + python3 --version + python3 -m py_compile .github/scripts/*.py tools/*.py diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 0000000..4b17fb8 --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,14 @@ +# actionlint settings for the ops repo. Used by .gitea/workflows/ops-lint.yml and by a local +# `actionlint` run from the repo root. Only Gitea features that actionlint does not know are +# ignored here; everything else stays an error. +paths: + .gitea/workflows/*.yml: + ignore: + # Gitea's own token scope for releases (runbook §3.2 item 5) + - 'unknown permission scope "releases"' + # Gitea resolves full-URL actions; bare owner/repo goes to github.com (runbook §1) + - 'specifying action "https://gitea\.com/[^"]+" in invalid format' + .gitea/workflows/reusable-macos-swift.yml: + ignore: + # Kept but switched off on purpose: there is no macOS runner (runbook §5.6) + - 'constant expression "false" in condition' -- 2.54.1 From c09a89c4bec31c76136b72ed90cc2064ecdf3b07 Mon Sep 17 00:00:00 2001 From: poli0981 Date: Mon, 23 Nov 2026 17:50:34 +0700 Subject: [PATCH 3/7] chore: Renovate for the ops repo's own action pins Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MnPQKxkPgL2sb8BqwHKv5k --- renovate.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 renovate.json diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..1564446 --- /dev/null +++ b/renovate.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["local>poli0981/renovate-config"] +} -- 2.54.1 From 50e7724cb556e8df45cb0d6823f867e5f6f23deb Mon Sep 17 00:00:00 2001 From: poli0981 Date: Mon, 23 Nov 2026 17:50:34 +0700 Subject: [PATCH 4/7] feat(tools): read-only migration inventory for any repo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tools/migration-inventory.py reports, from tracked files only, every workflow (triggers, crons outside 13:00-16:00 UTC, runners, actions that do not work on Gitea, unpinned actions, unsupported permissions, secrets, ops calls), the migration markers and the GitHub references left. Runbook §3.1 starts with it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MnPQKxkPgL2sb8BqwHKv5k --- tools/migration-inventory.py | 277 +++++++++++++++++++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 tools/migration-inventory.py diff --git a/tools/migration-inventory.py b/tools/migration-inventory.py new file mode 100644 index 0000000..54154a0 --- /dev/null +++ b/tools/migration-inventory.py @@ -0,0 +1,277 @@ +"""Read-only Gitea-migration inventory of local repos (runbook §3.1). + +Usage, from anywhere: + python3 tools/migration-inventory.py [--json OUT.json] [REPO_DIR ...] (default: .) + +Nothing is written inside the repos. For each repo it reports the git state, every workflow +(where it lives, triggers, crons and whether they fit 13:00-16:00 UTC, runners, actions that do +not work on Gitea, unpinned actions, unsupported permissions, secrets, calls to the ops repo), +migration markers (renovate.json, dependabot, SECURITY.md, GitLab templates, ...) and the +GitHub references left in tracked files. Needs Python 3.10+; PyYAML is optional (without it, +triggers, runners and permissions are not parsed). +""" +import json +import pathlib +import re +import subprocess +import sys + +try: + import yaml # PyYAML +except ImportError: # pragma: no cover + yaml = None + +SKIP_DIRS = {".git", "node_modules", "bin", "obj", "target", "dist", "build", ".svelte-kit", ".next", + ".astro", ".wrangler", "vendor", ".venv", "venv", "__pycache__", ".idea", ".vs", ".claude", + "coverage", ".output", ".turbo", "packages", "out", ".pnpm-store", "TestResults"} +TEXT_EXT = {".md", ".json", ".jsonc", ".toml", ".yml", ".yaml", ".cs", ".csproj", ".props", ".targets", + ".resx", ".xaml", ".ts", ".tsx", ".js", ".mjs", ".cjs", ".svelte", ".astro", ".py", ".rs", + ".html", ".txt", ".cfg", ".ini", ".xml", ".sh", ".ps1", ".iss", ".nuspec", ".gitmodules"} +GH_PATTERNS = { + "github.com/poli0981": re.compile(r"github\.com/poli0981(?:org)?\b", re.I), + "githubusercontent": re.compile(r"githubusercontent\.com", re.I), + "api.github.com": re.compile(r"api\.github\.com", re.I), + "github.io": re.compile(r"\.github\.io", re.I), + "GithubSource": re.compile(r"GithubSource"), +} +UNSUPPORTED_PERMS = {"id-token", "statuses", "checks", "deployments", "security-events", "pages", "attestations"} +BAD_ACTIONS = { + "github/codeql-action": "CodeQL (not on Gitea)", + "actions/upload-artifact": "upstream artifact v4 (use christopherhx/gitea-upload-artifact)", + "actions/download-artifact": "upstream artifact v4 (use christopherhx/gitea-download-artifact)", + "softprops/action-gh-release": "GitHub release action", + "ncipollo/release-action": "GitHub release action", + "tauri-apps/tauri-action": "tauri-action (build with Tauri CLI + R2)", + "cloudflare/wrangler-action": "wrangler-action (use npx wrangler deploy)", + "JetBrains/qodana-action": "qodana-action (use Qodana CLI)", + "aquasecurity/trivy-action": "trivy-action (removed, supply-chain incident)", + "aquasecurity/setup-trivy": "setup-trivy (removed)", + "actions/github-script": "github-script (GitHub API)", + "actions/configure-pages": "GitHub Pages", + "actions/upload-pages-artifact": "GitHub Pages", + "actions/deploy-pages": "GitHub Pages", + "actions/dependency-review-action": "dependency review (GitHub only)", + "actions/attest-build-provenance": "attestations (GitHub only)", + "actions/stale": "stale bot", + "SonarSource/sonarqube-scan-action": "SonarCloud (dropped)", + "SonarSource/sonarcloud-github-action": "SonarCloud (dropped)", +} +SHA_RE = re.compile(r"@[0-9a-f]{40}\b") + + +def git(repo, *args): + r = subprocess.run(["git", "-C", str(repo), "-c", "core.autocrlf=true", *args], + capture_output=True, text=True) + return r.stdout.strip() + + +def walk_text_files(root): + """Tracked files only (git ls-files): build output and reports are not the repo.""" + listed = git(root, "ls-files", "-z") + if listed: + for rel in listed.split("\0"): + p = root / rel + if rel and (p.suffix.lower() in TEXT_EXT or p.name in {"Dockerfile", ".gitmodules", "CODEOWNERS"}): + try: + if p.is_file() and p.stat().st_size <= 2_000_000: + yield p + except OSError: + pass + return + stack = [root] + while stack: + d = stack.pop() + try: + entries = list(d.iterdir()) + except OSError: + continue + for p in entries: + if p.is_dir(): + if p.name not in SKIP_DIRS and not p.is_symlink(): + stack.append(p) + elif p.suffix.lower() in TEXT_EXT or p.name in {"Dockerfile", ".gitmodules", "CODEOWNERS"}: + try: + if p.stat().st_size <= 2_000_000: + yield p + except OSError: + pass + + +def triggers_of(doc): + on = doc.get("on", doc.get(True)) # PyYAML parses bare `on` as True + if isinstance(on, str): + return [on], [] + if isinstance(on, list): + return on, [] + if isinstance(on, dict): + crons = [c.get("cron") for c in (on.get("schedule") or []) if isinstance(c, dict)] + return list(on.keys()), crons + return [], [] + + +def analyse_workflow(path): + text = path.read_text(encoding="utf-8", errors="replace") + info = {"file": path.name, "triggers": [], "crons": [], "runs_on": [], "uses": [], "unpinned": [], + "bad_actions": [], "unsupported_perms": [], "secrets": sorted(set(re.findall(r"secrets\.([A-Za-z0-9_]+)", text))), + "vars": sorted(set(re.findall(r"vars\.([A-Za-z0-9_]+)", text))), "ops_calls": [], "name": None, + "macos": bool(re.search(r"macos-", text)), "parse_error": None} + for line in text.splitlines(): + m = re.match(r"\s*-?\s*uses:\s*([^\s#]+)", line) + if not m: + continue + ref = m.group(1).strip("'\"") + info["uses"].append(ref) + base = ref.split("@")[0] + if "poli0981/.github/" in ref: + info["ops_calls"].append(ref) + elif not ref.startswith("./") and not ref.startswith("$/") and not ref.startswith("docker://") \ + and not SHA_RE.search(ref): + info["unpinned"].append(ref) + for bad, why in BAD_ACTIONS.items(): + if base.lower().startswith(bad.lower()): + info["bad_actions"].append(f"{base}: {why}") + if yaml: + try: + doc = yaml.safe_load(text) or {} + info["name"] = doc.get("name") + info["triggers"], info["crons"] = triggers_of(doc) + perms = [] + if isinstance(doc.get("permissions"), dict): + perms += list(doc["permissions"].keys()) + for job in (doc.get("jobs") or {}).values(): + if not isinstance(job, dict): + continue + ro = job.get("runs-on") + if ro is not None: + info["runs_on"].append(ro if isinstance(ro, str) else json.dumps(ro)) + if isinstance(job.get("permissions"), dict): + perms += list(job["permissions"].keys()) + info["unsupported_perms"] = sorted(set(perms) & UNSUPPORTED_PERMS) + info["triggers"] = [str(t) for t in info["triggers"]] + except Exception as e: # noqa: BLE001 + info["parse_error"] = str(e)[:200] + info["runs_on"] = sorted(set(info["runs_on"])) + return info + + +def detect_stack(root): + s = [] + names = {p.name for p in root.iterdir()} + tracked = git(root, "ls-files").splitlines() + if any(t.endswith((".sln", ".slnx", ".csproj")) for t in tracked): + s.append("dotnet") + if any(t.endswith("tauri.conf.json") for t in tracked): + s.append("tauri") + if "package.json" in names: + pkg = (root / "package.json").read_text(encoding="utf-8", errors="replace") + for fw in ("wxt", "@sveltejs/kit", "astro", "react", "vite", "svelte"): + if f'"{fw}"' in pkg: + s.append(f"node:{fw}") + break + else: + s.append("node") + if "Cargo.toml" in names or (root / "src-tauri" / "Cargo.toml").exists(): + s.append("rust") + if "pyproject.toml" in names or "requirements.txt" in names: + s.append("python") + if names & {"wrangler.jsonc", "wrangler.json", "wrangler.toml"}: + s.append("workers") + return s + + +def inventory(root): + root = pathlib.Path(root).resolve() + r = {"repo": root.name, "branch": git(root, "branch", "--show-current"), + "dirty": [l for l in git(root, "status", "--short").splitlines() if l and not l.startswith("?? .claude")], + "has_migration_branch": bool(git(root, "branch", "--list", "chore/gitea-migration")), + "remote_origin": git(root, "remote", "get-url", "origin"), + "stack": detect_stack(root), "workflows": {}, "files": {}, "github_refs": {}, "github_ref_files": {}} + for d in (".github/workflows", ".gitea/workflows"): + p = root / d + if p.is_dir(): + r["workflows"][d] = [analyse_workflow(f) for f in sorted(p.iterdir()) + if f.suffix in (".yml", ".yaml")] + checks = { + "dependabot": ".github/dependabot.yml", "renovate.json": "renovate.json", + "SECURITY.md": "SECURITY.md", "CONTRIBUTING.md": "CONTRIBUTING.md", "CLAUDE.md": "CLAUDE.md", + "qodana.yaml": "qodana.yaml", "deny.toml": "deny.toml", "gitlab_issue_templates": ".gitlab/issue_templates", + "gitlab_mr_templates": ".gitlab/merge_request_templates", "gh_issue_templates": ".github/ISSUE_TEMPLATE", + "gh_pr_template": ".github/pull_request_template.md", "CODEOWNERS": ".github/CODEOWNERS", + "FUNDING": ".github/FUNDING.yml", "gitea_issue_templates": ".gitea/ISSUE_TEMPLATE", + } + for k, rel in checks.items(): + r["files"][k] = (root / rel).exists() + sec = root / "SECURITY.md" + if sec.exists(): + t = sec.read_text(encoding="utf-8", errors="replace") + r["files"]["SECURITY_mentions_github_advisory"] = bool(re.search(r"security/advisories|private vulnerability|Report a vulnerability", t, re.I)) + r["files"]["SECURITY_mentions_security_at"] = "security@poli0981.dev" in t + emails = set() + for f in walk_text_files(root): + try: + t = f.read_text(encoding="utf-8", errors="replace") + except OSError: + continue + rel = str(f.relative_to(root)).replace("\\", "/") + for key, rx in GH_PATTERNS.items(): + n = len(rx.findall(t)) + if n: + r["github_refs"][key] = r["github_refs"].get(key, 0) + n + r["github_ref_files"].setdefault(key, []).append(f"{rel}:{n}") + emails.update(re.findall(r"[A-Za-z0-9._%+-]+@poli0981\.dev", t)) + r["emails"] = sorted(emails) + for k in r["github_ref_files"]: + r["github_ref_files"][k] = sorted(r["github_ref_files"][k], key=lambda s: -int(s.rsplit(":", 1)[1]))[:25] + return r + + +def cron_in_window(expr): + """True when every hour of a 5-field cron is inside 13-15 (13:00-16:00 UTC) and the minute is fixed.""" + parts = (expr or "").split() + if len(parts) != 5 or not parts[0].isdigit(): + return False + hours = parts[1].split(",") + return all(h.isdigit() and 13 <= int(h) <= 15 for h in hours) + + +def main(): + args = sys.argv[1:] + out = None + if args[:1] == ["--json"]: + out, args = pathlib.Path(args[1]), args[2:] + data = [inventory(p) for p in (args or ["."])] + for r in data: + for items in r["workflows"].values(): + for w in items: + w["crons_outside_window"] = [c for c in w["crons"] if not cron_in_window(c)] + if out: + out.write_text(json.dumps(data, indent=1, default=str), encoding="utf-8") + for r in data: + wf = r["workflows"] + print(f"\n## {r['repo']} [{', '.join(r['stack'])}] branch={r['branch']} migration-branch={r['has_migration_branch']} dirty={len(r['dirty'])}") + for d, items in wf.items(): + print(f" {d}: {len(items)} workflows") + for w in items: + flags = [] + if w["crons"]: + flags.append("cron=" + ",".join(w["crons"])) + if w["crons_outside_window"]: + flags.append("CRON-OUTSIDE-13-16-UTC") + if w["bad_actions"]: + flags.append("BAD=" + "; ".join(sorted(set(w["bad_actions"])))) + if w["unpinned"]: + flags.append(f"unpinned={len(w['unpinned'])}") + if w["unsupported_perms"]: + flags.append("perms=" + ",".join(w["unsupported_perms"])) + if w["macos"]: + flags.append("macOS") + if w["ops_calls"]: + flags.append("ops=" + ",".join(sorted({c.split('/')[-1] for c in w['ops_calls']}))) + print(f" - {w['file']}: on={','.join(w['triggers'])} runs-on={','.join(w['runs_on'])} secrets={','.join(w['secrets'])} {' '.join(flags)}") + print(" files: " + ", ".join(k for k, v in r["files"].items() if v)) + print(" github refs: " + json.dumps(r["github_refs"])) + print(" emails: " + ", ".join(r["emails"])) + + +if __name__ == "__main__": + main() -- 2.54.1 From fd04dfe08fcb94fed81f125021394fd903916d0b Mon Sep 17 00:00:00 2001 From: poli0981 Date: Mon, 23 Nov 2026 17:50:34 +0700 Subject: [PATCH 5/7] feat(maintainer): Renovate collaborator and labels for every repo gitea-repo-setup.ps1 adds renovate-bot as a Write collaborator and creates the labels dependencies and security wherever they are missing, with -DryRun, -Only and -Exclude. It changes nothing else. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MnPQKxkPgL2sb8BqwHKv5k --- maintainer/gitea-repo-setup.ps1 | 177 ++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 maintainer/gitea-repo-setup.ps1 diff --git a/maintainer/gitea-repo-setup.ps1 b/maintainer/gitea-repo-setup.ps1 new file mode 100644 index 0000000..b3511cd --- /dev/null +++ b/maintainer/gitea-repo-setup.ps1 @@ -0,0 +1,177 @@ +#Requires -Version 7.0 +<# +.SYNOPSIS + Chuan bi hang loat repo tren Gitea cho Renovate: them renovate-bot lam collaborator (Write) + va tao nhan 'dependencies' + 'security' (runbook §3.5, §4.2). + +.DESCRIPTION + Voi tung repo cua -Owner tren Gitea (bo qua repo archived, repo mirror va repo rong): + * Neu -Bot chua la collaborator: them voi quyen Write. Thieu buoc nay, Renovate + khong thay repo (autodiscover chi liet ke repo bot co quyen day code). + * Tao nhan con thieu: 'dependencies' (moi PR cua Renovate) va 'security' + (PR va loi OSV). Renovate bo qua nhan khong ton tai ma khong bao loi. + Khong bat Actions, khong doi setting nao khac. Chay lai nhieu lan duoc: chi lam phan con thieu. + + Token: Settings > Applications > Generate New Token, quyen + repository = Read and Write (collaborator) + issue = Read and Write (nhan) + user = Read (liet ke repo qua /user/repos) + Dat vao bien moi truong GITEA_TOKEN, hoac dan khi script hoi. Xoa token sau khi dung. + + Chay -DryRun truoc de xem se lam gi. + +.EXAMPLE + .\gitea-repo-setup.ps1 -DryRun + .\gitea-repo-setup.ps1 + .\gitea-repo-setup.ps1 -Only ticktune,pipdock + .\gitea-repo-setup.ps1 -Exclude .github,.profile +#> +[CmdletBinding()] +param( + [string] $GiteaUrl = 'https://git.poli0981.dev', + [string] $Owner = 'poli0981', + [string] $Bot = 'renovate-bot', + [string[]] $Only = @(), + [string[]] $Exclude = @(), + [switch] $SkipCollaborator, + [switch] $SkipLabels, + [switch] $DryRun +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +$GiteaUrl = $GiteaUrl.TrimEnd('/') +$Api = "$GiteaUrl/api/v1" + +# Nhan Renovate dung (runbook §4.2). Mau giong GitHub de de nhan ra. +$Labels = @( + [pscustomobject]@{ Name = 'dependencies'; Color = '#0366d6'; Description = 'Dependency updates (Renovate)' }, + [pscustomobject]@{ Name = 'security'; Color = '#d73a4a'; Description = 'Security fixes (Renovate OSV alerts)' } +) + +function Write-Step([string]$Msg) { Write-Host "`n==> $Msg" -ForegroundColor Green } +function Write-Warn([string]$Msg) { Write-Host "[!] $Msg" -ForegroundColor Yellow } +function Write-Bad ([string]$Msg) { Write-Host "[LOI] $Msg" -ForegroundColor Red } + +# Goi API Gitea, khong nem loi theo HTTP status; tra ve Status + Body de tu xu ly. +function Invoke-Api([string]$Method, [string]$Path, $Body = $null) { + $params = @{ + Method = $Method + Uri = "$Api$Path" + Headers = $Headers + SkipHttpErrorCheck = $true + StatusCodeVariable = 'apiStatus' + } + if ($null -ne $Body) { + $params.Body = ($Body | ConvertTo-Json) + $params.ContentType = 'application/json' + } + $res = Invoke-RestMethod @params + [pscustomobject]@{ Status = [int]$apiStatus; Body = $res } +} + +function Get-ApiMessage($Body) { + if ($null -ne $Body -and $Body.PSObject.Properties['message']) { return [string]$Body.message } + return [string]$Body +} + +# Lay het cac trang cua mot API liet ke (Gitea tra toi da 50 muc/trang). +function Get-AllPages([string]$Path) { + $items = [System.Collections.Generic.List[object]]::new() + $sep = if ($Path.Contains('?')) { '&' } else { '?' } + for ($page = 1; $page -le 100; $page++) { + $r = Invoke-Api GET "$Path${sep}limit=50&page=$page" + if ($r.Status -ne 200) { throw "GET $Path (trang $page): HTTP $($r.Status) $(Get-ApiMessage $r.Body)" } + $batch = @($r.Body) + if ($batch.Count -eq 0) { break } + $items.AddRange($batch) + } + return $items +} + +# --- 1. Token -------------------------------------------------------------------- +Write-Step '1/3 Kiem tra token' +$token = $env:GITEA_TOKEN +if (-not $token) { + $sec = Read-Host 'Dan Gitea access token (Settings > Applications)' -AsSecureString + $token = [System.Net.NetworkCredential]::new('', $sec).Password +} +if (-not $token) { throw 'Chua co token.' } +$Headers = @{ Authorization = "token $token"; Accept = 'application/json' } + +$r = Invoke-Api GET '/user' +if ($r.Status -ne 200) { throw "Token khong dung duoc (HTTP $($r.Status)): $(Get-ApiMessage $r.Body)" } +Write-Host "Token cua '$($r.Body.login)'." +if (-not $SkipCollaborator) { + $r = Invoke-Api GET "/users/$([Uri]::EscapeDataString($Bot))" + if ($r.Status -ne 200) { throw "Khong thay user '$Bot' tren Gitea (HTTP $($r.Status)). Tao bot truoc (runbook §4.2)." } +} + +# --- 2. Danh sach repo ------------------------------------------------------------- +Write-Step "2/3 Liet ke repo cua '$Owner'" +$repos = @(Get-AllPages '/user/repos' | Where-Object { $_.owner.login -eq $Owner } | Sort-Object name) +$todo = foreach ($repo in $repos) { + $why = $null + if ($Only.Count -and $repo.name -notin $Only) { continue } + if ($repo.name -in $Exclude) { $why = 'loai tru (-Exclude)' } + elseif ($repo.archived) { $why = 'archived' } + elseif ($repo.mirror) { $why = 'mirror' } + elseif ($repo.empty) { $why = 'repo rong' } + if ($why) { Write-Host (" bo qua {0,-28} {1}" -f $repo.name, $why); continue } + $repo +} +$todo = @($todo) +$repoNames = @($repos | ForEach-Object { $_.name }) +foreach ($name in $Only) { + if ($name -notin $repoNames) { Write-Warn "Khong thay repo '$name' cua $Owner." } +} +Write-Host "$($todo.Count) repo can kiem tra." + +# --- 3. Collaborator + nhan -------------------------------------------------------- +Write-Step ('3/3 ' + $(if ($DryRun) { 'DRY RUN: chi in ra viec se lam' } else { 'Cap nhat' })) +$summary = foreach ($repo in $todo) { + $full = "$Owner/$($repo.name)" + $path = "/repos/$([Uri]::EscapeDataString($Owner))/$([Uri]::EscapeDataString($repo.name))" + $row = [ordered]@{ Repo = $repo.name; Collaborator = '-'; Labels = '-'; Loi = '' } + try { + if (-not $SkipCollaborator) { + $c = Invoke-Api GET "$path/collaborators/$([Uri]::EscapeDataString($Bot))" + if ($c.Status -eq 204) { $row.Collaborator = 'da co' } + elseif ($c.Status -eq 404) { + if ($DryRun) { $row.Collaborator = 'SE THEM (write)' } + else { + $p = Invoke-Api PUT "$path/collaborators/$([Uri]::EscapeDataString($Bot))" @{ permission = 'write' } + if ($p.Status -ne 204) { throw "them collaborator: HTTP $($p.Status) $(Get-ApiMessage $p.Body)" } + $row.Collaborator = 'DA THEM (write)' + } + } + else { throw "kiem tra collaborator: HTTP $($c.Status) $(Get-ApiMessage $c.Body)" } + } + if (-not $SkipLabels) { + $have = @(Get-AllPages "$path/labels" | ForEach-Object { $_.name }) + $missing = @($Labels | Where-Object { $_.Name -notin $have }) + $missingNames = ($missing | ForEach-Object { $_.Name }) -join ', ' + if ($missing.Count -eq 0) { $row.Labels = 'da du' } + elseif ($DryRun) { $row.Labels = "SE TAO: $missingNames" } + else { + foreach ($l in $missing) { + $p = Invoke-Api POST "$path/labels" @{ name = $l.Name; color = $l.Color; description = $l.Description } + if ($p.Status -ne 201) { throw "tao nhan '$($l.Name)': HTTP $($p.Status) $(Get-ApiMessage $p.Body)" } + } + $row.Labels = "DA TAO: $missingNames" + } + } + } + catch { + $row.Loi = "$_" + Write-Bad "${full}: $_" + } + [pscustomobject]$row +} + +$summary | Format-Table -AutoSize | Out-Host +$failed = @($summary | Where-Object { $_.Loi }) +if ($failed.Count) { Write-Bad "$($failed.Count) repo loi (xem cot Loi)."; exit 1 } +if ($DryRun) { Write-Host 'Dry run xong. Chay lai khong co -DryRun de ap dung.' -ForegroundColor Cyan } +else { Write-Host 'Xong. Nho xoa token vua dung (Settings > Applications).' -ForegroundColor Cyan } -- 2.54.1 From 79b57af093badff9cf724a0c1a1fe594376744a6 Mon Sep 17 00:00:00 2001 From: poli0981 Date: Mon, 23 Nov 2026 17:50:35 +0700 Subject: [PATCH 6/7] docs(migration): a guide per inventoried repo docs/migration/ holds the index (status, cron-slot registry, the maintainer decisions D1-D7 shared by several repos, gh CLI to Gitea API), the rest of the pilot for ticktune, and a guide each for pipdock, frameledger, OmniDeck, bookmarkmagic, softharbor, poli0981-dev and tilepier: what to do with every workflow, new cron slots, secrets, release path, files and code that still point at GitHub, and the questions to answer first. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MnPQKxkPgL2sb8BqwHKv5k --- docs/migration/README.md | 99 +++++++++++++++++++++++++++++++++ docs/migration/bookmarkmagic.md | 30 ++++++++++ docs/migration/frameledger.md | 38 +++++++++++++ docs/migration/omnideck.md | 38 +++++++++++++ docs/migration/pipdock.md | 40 +++++++++++++ docs/migration/poli0981-dev.md | 36 ++++++++++++ docs/migration/softharbor.md | 31 +++++++++++ docs/migration/ticktune.md | 21 +++++++ docs/migration/tilepier.md | 28 ++++++++++ 9 files changed, 361 insertions(+) create mode 100644 docs/migration/README.md create mode 100644 docs/migration/bookmarkmagic.md create mode 100644 docs/migration/frameledger.md create mode 100644 docs/migration/omnideck.md create mode 100644 docs/migration/pipdock.md create mode 100644 docs/migration/poli0981-dev.md create mode 100644 docs/migration/softharbor.md create mode 100644 docs/migration/ticktune.md create mode 100644 docs/migration/tilepier.md diff --git a/docs/migration/README.md b/docs/migration/README.md new file mode 100644 index 0000000..95f2fd3 --- /dev/null +++ b/docs/migration/README.md @@ -0,0 +1,99 @@ +# Per-repo migration guides + +> **Audience:** the maintainer and the agent session that migrates one repository (runbook §0). +> **Written:** 2026-11-23, from `tools/migration-inventory.py` run on the local clones in `E:\` and a read of each workflow's header. Each guide names the commit it was written against. If the repo has moved on, re-run the inventory and trust the repo. + +The runbook ([`../GITEA-MIGRATION.md`](../GITEA-MIGRATION.md)) is the procedure. A guide here only adds what is specific to one repository: what to do with each workflow, the new cron slots, the secrets, the release path, the files that still point at GitHub, and the questions the maintainer has to answer first. + +## How to run one migration + +1. Answer the repo's **Decisions** section (or the shared ones below). +2. Open a Claude Code session in the repo and give it: + + > Follow `E:\.github\docs\GITEA-MIGRATION.md` §3 for this repo, with `E:\.github\docs\migration\.md` for the repo-specific steps. Work on branch `chore/gitea-migration`, one logical change per commit. Run `python3 E:\.github\tools\migration-inventory.py .` first and report what differs from the guide. Stop at §3.8 with the hand-off report. + +3. Do the hand-off steps, then tick the repo in the runbook's tracker (§8). + +For the repos without a guide yet, the same prompt works with only the runbook: §3.1 now starts with the inventory tool. + +## Status + +| Repo | Profile | State on 2026-11-23 | Guide | +|---|---|---|---| +| `ticktune` | web (Astro, Workers) | **Pilot.** `chore/gitea-migration` has 20 commits, not merged | [ticktune.md](ticktune.md) | +| `pipdock` | Tauri + Rust + React | not started; workflows project-local by design | [pipdock.md](pipdock.md) | +| `frameledger` | .NET/WPF + C++, Velopack | not started | [frameledger.md](frameledger.md) | +| `OmniDeck` | .NET/WPF, Velopack | not started | [omnideck.md](omnideck.md) | +| `bookmarkmagic` | Chrome/Edge/Firefox extension (WXT) | not started | [bookmarkmagic.md](bookmarkmagic.md) | +| `softharbor` | web (Astro, Workers) + data bots | not started | [softharbor.md](softharbor.md) | +| `poli0981-dev` | web (Astro, Workers) + admin | not started | [poli0981-dev.md](poli0981-dev.md) | +| `tilepier` | web (SvelteKit, Workers) | not started | [tilepier.md](tilepier.md) | +| all other repos in `E:\` | — | **not inventoried** (no access from the session that wrote this) | run the inventory | + +## Cron slots (UTC) — the registry + +Every scheduled workflow gets its own slot inside 13:00–16:00 UTC (runbook §3.2 item 9), so nothing piles up on the one runner. Take a free slot from here and add it to this table in the same change. + +| Slot (UTC) | Days | Repo · workflow | Status | +|---|---|---|---| +| 13:17 | daily | softharbor · quarantine | proposed | +| 13:23 | daily | pipdock · security-scan | proposed | +| 13:31 | daily | renovate-config · renovate | live | +| 13:47 | daily | pipdock · ci-integration (nightly) | proposed | +| 13:59 | daily | softharbor · vt-recheck | proposed | +| 14:07 | Sun | .github · weekly-digest | live | +| 14:13 | Wed | poli0981-dev · security | proposed | +| 14:19 | Thu | pipdock · security (if it calls the ops repo, D4) | proposed | +| 14:23 | Sat | OmniDeck · security | proposed | +| 14:29 | daily | tilepier · e2e | proposed | +| 14:37 | Mon | ticktune · audit | on the pilot branch | +| 14:41 | Fri | frameledger · security | proposed | +| 14:43 | Mon | softharbor · link-check | proposed | +| 14:53 | Tue | pipdock · ci-integration (weekly fixtures) | proposed | +| 14:59 | Sun | bookmarkmagic · security | proposed | +| 15:07 | Thu | tilepier · security | proposed | +| 15:13 | Mon | ticktune · qodana | on the pilot branch | +| 15:29 | Wed | ticktune · security | on the pilot branch | +| 15:37 | Tue | softharbor · security | proposed | +| 15:41 | Mon | bookmarkmagic · qodana | proposed | + +## Decisions that cover several repos (maintainer) + +The agent flags these and does not choose. The default is what the guides assume. + +| # | Question | Default in the guides | +|---|---|---| +| D1 | SonarQube Cloud: you said Sonar is not usable any more. Remove every Sonar job, `sonar-project.properties` and the `SONAR_TOKEN` secret? (The pilot still has its `sonar` job.) | **Remove.** Qodana + Opengrep cover the analysis | +| D2 | Maintenance-mode triage (`triage.yml`, `pull_request_target` + `gh`/`github-script`): outsiders cannot open issues or PRs on Gitea, and GitLab mirror issues are not seen by Gitea Actions | **Remove** the workflow and its script; keep the policy text in CONTRIBUTING (the pilot did this) | +| D3 | Web deploys: Cloudflare **Workers Builds** pulled from GitHub and stops now. Deploy with `wrangler deploy` from Gitea CI (the pilot's `deploy.yml`, or `reusable-web-react.yml` with `deploy-workers: true`), or connect Workers Builds to the GitLab mirror (runbook §7 item 7) | **Gitea CI + wrangler** (needs `CLOUDFLARE_API_TOKEN`/`CLOUDFLARE_ACCOUNT_ID`) | +| D4 | Repos whose workflows are project-local on purpose (pipdock moved to the `poli0981org` org on GitHub so no other account could change its CI). On Gitea it lives under `poli0981`, the same owner as the ops repo, and callers pin a commit SHA, so no one can change what runs | **Call the ops repo** (security, notify), pinned by SHA; keep the rest local | +| D5 | Bot pull requests and issues (softharbor quarantine / vt-recheck / link-check, poli0981-dev content-bump): a PR opened with `GITEA_TOKEN` starts no workflow on Gitea either, so its required checks never run. Use a PAT of `renovate-bot` (or a second bot) as a repo secret, or dispatch CI on the bot branch (`POST …/actions/workflows//dispatches`: Gitea starts a dispatched run whoever asks, so the job token works, with `actions: write`; read from the Gitea source, **VERIFY** on 28.4.0) | **Dispatch CI** on the bot branch, as the workflows already do with `gh workflow run` | +| D6 | Required checks / rulesets were GitHub rulesets. Recreate them as Gitea **branch protection** on `main` with status-check patterns | Maintainer step in each hand-off | +| D7 | GitHub-only extras with no Gitea equivalent: build-provenance attestations (no OIDC), OpenSSF Scorecard, dependency review (licence gate), `dependency-graph/sbom`, GitHub Wiki | **Drop** attestations, Scorecard and dependency review (osv-scanner + cargo-deny/NuGetAudit cover vulnerabilities; licences: see each guide). SBOM: generate it in the build (e.g. CycloneDX) and upload it next to the release on R2 | + +## `gh` CLI → Gitea API + +`gh` only talks to github.com. On Gitea, call the REST API with the job token (`${{ github.token }}`, `Authorization: token …`) at `${{ github.api_url }}` (= `https://git.poli0981.dev/api/v1`). The routes below were checked against the Gitea source on 2026-11-23. + +| `gh` | Gitea API | +|---|---| +| `gh issue create` | `POST /repos/{owner}/{repo}/issues` `{title, body, labels:[