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/.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 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' diff --git a/docs/GITEA-MIGRATION.md b/docs/GITEA-MIGRATION.md index ef53f8a..17cca22 100644 --- a/docs/GITEA-MIGRATION.md +++ b/docs/GITEA-MIGRATION.md @@ -2,7 +2,7 @@ > **Audience:** AI coding agents (Claude Code sessions) and the maintainer (Kokone / `poli0981`). > **Scope:** apply this runbook **one repository per session**. Start with the ops repo (§4), then a pilot repo, then the rest. -> **Last verified against:** Gitea 28.4.0, gitea-runner 2.x, Velopack CLI 1.2.x, November 2026. Items marked **VERIFY** must be confirmed on the pilot repo before being applied everywhere. +> **Last verified against:** Gitea 28.4.0, gitea-runner 2.x, Velopack CLI 1.2.x, Renovate 44.257.9, November 2026. Items marked **VERIFY** must be confirmed on the pilot repo before being applied everywhere. Items marked **(source)** were read from the Gitea source (main, 2026-11-23): one look on the pilot still settles them. --- @@ -13,6 +13,8 @@ 3. The maintainer does the manual steps listed in the hand-off report (secrets, enabling Actions, R2, Qodana, mirror). 4. Tick the repo off in §8. +Repo-specific guides are in [`migration/`](migration/README.md): one file per inventoried repo, the cron-slot registry and the maintainer decisions shared by several repos (D1–D7). When a repo has a guide, give it to the agent together with this file. + The agent must **not** improvise around anything still listed as an open maintainer decision (§7). If something here conflicts with the repo's own `CLAUDE.md`, this file wins for migration topics only and the conflict must be reported. --- @@ -30,7 +32,7 @@ The agent must **not** improvise around anything still listed as an open maintai | Registration | Disabled on the instance. Outside people **cannot** open issues or PRs on Gitea | | Public mirror | `https://gitlab.com/poli0981/`: push mirror fed by Gitea only (`sync_on_commit` + every 8 h). GitLab CI is disabled there. **This is where outside issues and merge requests go** | | Contact | Patches / questions: `code@poli0981.dev`. Security reports: `security@poli0981.dev`. If a repo already documents another address of the same domain, keep it | -| CI | Gitea Actions. Job token: `GITEA_TOKEN` (`secrets.GITHUB_TOKEN` / `github.token` alias **VERIFY**). Contexts `github.*` and `gitea.*` both work | +| CI | Gitea Actions. Job token: `GITEA_TOKEN`; `secrets.GITHUB_TOKEN` and `github.token` are the same token, in called workflows too (source). Contexts `github.*` and `gitea.*` both work. Events caused by the job token start no workflow (§6) | | Action source | Bare `uses: owner/action@ref` resolves to **github.com**. Gitea-hosted actions need a full URL: `uses: https://gitea.com/actions/@` | | Runner | One runner on the maintainer's Windows 11 PC, user-scoped (only `poli0981` repos). Online only while the PC is on | | Runner labels | `windows-latest`, `windows` → **host mode** (no isolation, PowerShell). `ubuntu-latest`, `ubuntu-24.04`, `ubuntu-22.04` → Docker (`docker.gitea.com/runner-images:*`) | @@ -66,7 +68,13 @@ The agent must **not** improvise around anything still listed as an open maintai ### 3.1 Inventory (read-only, report the results first) -Run from the repo root and summarise the output before changing anything: +Run the ops repo's inventory tool from the repo root (read-only, tracked files only) and summarise it before changing anything: + +```bash +python3 /tools/migration-inventory.py . # on the PC: E:\.github\tools\migration-inventory.py +``` + +It lists every workflow (triggers, crons outside the window, runners, actions that do not work on Gitea, unpinned actions, unsupported permissions, secrets, calls to the ops repo), the migration markers and the GitHub references left. Then, for what it does not cover: ```bash git remote -v @@ -89,7 +97,9 @@ Classify the repo into one or more **stack profiles** (§5) and list every workf ```yaml uses: poli0981/.github/.gitea/workflows/.yml@ # ops vYYYY.MM.N ``` - Pass secrets **explicitly** (`secrets: { NAME: ${{ secrets.NAME }} }`). `secrets: inherit` is **VERIFY**. + Pass secrets **explicitly** (`secrets: { NAME: ${{ secrets.NAME }} }`), the repo convention; Gitea also supports `secrets: inherit` (source). + Callers of the notifiers (`notify-*`, `announce-release`) also pass `ops_ref: `, so the script they load matches the workflow. + Renovate does **not** bump these pins. It reads no version in `# ops …`, so it skips the stub as `unversioned-reference` (measured, Renovate 44). Bump them by hand when the ops repo is tagged (§4.1). 4. **`runs-on` mapping:** | Was | Becomes | Note | @@ -112,8 +122,11 @@ Classify the repo into one or more **stack profiles** (§5) and list every workf | `softprops/action-gh-release`, `ncipollo/release-action` | `https://gitea.com/actions/gitea-release-action@` (inputs: `files`, `tag_name`, `name`, `body_path`, `draft`, `prerelease`; token defaults to `github.token`). Notes + links only, no binaries (§1) | | `tauri-apps/tauri-action` | Remove. Build with the Tauri CLI and publish to R2 (§5.2) | | `cloudflare/wrangler-action` | `npx wrangler deploy` (or `pnpm dlx`) with `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` env | - | `JetBrains/qodana-action` | Qodana CLI step (§3.5). The action relies on GitHub APIs for annotations | + | `JetBrains/qodana-action` | Ops `reusable-qodana.yml` (§4.5), or its CLI steps in a local job when the scan needs build pre-steps. The action relies on GitHub APIs for annotations | | `github/codeql-action/*` | Delete; Opengrep job from ops repo (§4.3) | + | `SonarSource/*` (SonarQube Cloud) | Remove, with `sonar-project.properties` (maintainer decision D1, [`migration/README.md`](migration/README.md)) | + | `actions/attest-build-provenance`, `ossf/scorecard-action`, `actions/dependency-review-action` | Remove (no OIDC, no code-scanning UI, no dependency graph); report it (D7) | + | `gh` CLI in `run:` steps | Gitea REST API with the job token ([`migration/README.md`](migration/README.md), "`gh` CLI → Gitea API") | | `actions/github-script`, `peter-evans/*` (create-PR, comment) | Remove or rewrite against the Gitea API with `GITEA_TOKEN`; report it | | `aquasecurity/trivy-action`, `setup-trivy` | Remove (supply-chain incident Mar 2026). osv-scanner covers dependencies | | Any R2 / S3 upload action | Ops reusable workflow `publish-r2.yml` (§4.4) or `vpk upload s3` (§5.1) | @@ -164,7 +177,8 @@ Files to check: - `CLAUDE.md` and the doc suite: CI paths (`.gitea/workflows`), release process (R2), forge URLs, runner and schedule facts (§1). Add a short "Forge & CI" section pointing to this runbook. - `SECURITY.md`: GitHub private vulnerability reporting no longer exists. Report by e-mail to `security@poli0981.dev` (or the address the repo already uses). Say explicitly: **do not open public issues on the GitLab mirror for vulnerabilities.** - `CONTRIBUTING.md`: canonical repo is on Gitea (read-only for outsiders). Issues and merge requests: GitLab mirror. Patches by e-mail (`git format-patch` / `git send-email`) to `code@poli0981.dev`. The maintainer applies accepted changes on Gitea; the mirror then updates GitLab and the MR is marked merged or closed. Mention that GitLab CI does not run on MRs; the maintainer runs CI on Gitea. -- Issue/MR templates: GitLab does not read GitHub issue forms. Convert each `.github/ISSUE_TEMPLATE/*.yml|*.md` to Markdown in `.gitlab/issue_templates/.md` and the PR template to `.gitlab/merge_request_templates/Default.md`. Keep the `.github/` originals (Gitea can read them; **VERIFY**). Drop `config.yml` contact links that point to GitHub. +- Issue/MR templates: GitLab does not read GitHub issue forms. Convert each `.github/ISSUE_TEMPLATE/*.yml|*.md` to Markdown in `.gitlab/issue_templates/.md` and the PR template to `.gitlab/merge_request_templates/Default.md`. Keep the `.github/` originals: Gitea reads `.gitea/ISSUE_TEMPLATE`, `.github/ISSUE_TEMPLATE` and `.github/issue_template` (source). Drop `config.yml` contact links that point to GitHub. +- `.github/CODEOWNERS` → `.gitea/CODEOWNERS`: Gitea reads only `CODEOWNERS`, `docs/CODEOWNERS` and `.gitea/CODEOWNERS`, and treats a pattern without `*` as a regular expression (source). - `.gitmodules`: GitHub URLs → Gitea URLs (only for repos that now live on Gitea). - Leave historical `CHANGELOG` entries untouched. @@ -177,12 +191,12 @@ Files to check: "extends": ["local>poli0981/renovate-config"] } ``` - Delete `.github/dependabot.yml`. Do not add a `schedule` here; the central runner's cron is the schedule (§4.2). + Delete `.github/dependabot.yml`. Do not add a `schedule` or a github.com token here: the central runner's cron is the schedule, and github.com tags are read over git (§4.2). Two steps belong to the maintainer, so list them in the hand-off (§3.8): add `renovate-bot` as a Write collaborator, or Renovate never sees the repo; and create the labels `dependencies` and `security`, or its PRs go out unlabelled. `maintainer/gitea-repo-setup.ps1 -Only ` in the ops repo does both. 2. **Security workflow:** add a caller to the ops repo's `security.yml` (§4.3) on `push` to `main`, `pull_request`, and a weekly schedule inside the window (§3.2 item 9). 3. **.NET:** keep NuGetAudit on. `net10.0+` audits transitive packages by default; for `net8.0`/`net9.0` projects set `all` in `Directory.Build.props`. CI should fail on `NU1903`/`NU1904` (high/critical) only. Consider `All` for CA security rules if not already set (report, don't force). 4. **Rust (Tauri):** add `deny.toml` (advisories + licenses compatible with GPL-3.0 + sources = crates.io only) for `cargo deny check`. -5. **Qodana:** keep `qodana.yaml`. CI step runs the Qodana CLI with `QODANA_TOKEN`: - - .NET/WPF (`net*-windows` TFMs) **must** run in native mode on `windows-latest`: `qodana scan --linter qodana-dotnet --within-docker false` (**VERIFY** flags with `qodana scan --help`). +5. **Qodana:** keep `qodana.yaml`. Call the ops `reusable-qodana.yml` (§4.5) with `QODANA_TOKEN`, or run the same CLI steps in a local job when the scan needs build pre-steps: + - .NET/WPF (`net*-windows` TFMs) **must** run in native mode on `windows-latest`: `qodana scan --linter qodana-dotnet --within-docker false` (flags as in the CLI 2026.3.1 README; native mode on the runner is **VERIFY**). - JS/TS, Python: Docker linters on `ubuntu-latest` are fine. - Report that the Qodana Cloud project's VCS URL must point to the Gitea HTTPS URL (maintainer task). @@ -199,7 +213,7 @@ Produce a table for the maintainer. Prefer **user-level** Actions secrets/variab | `TAURI_SIGNING_PRIVATE_KEY` / `TAURI_SIGNING_PRIVATE_KEY_PASSWORD` | secret | Tauri release | repo | existing key (do not regenerate: it would break updates) | | store/publish tokens (NuGet, PyPI, Chrome Web Store) | secret | publish jobs | repo | only if the repo publishes | -Do **not** carry over `GITHUB_TOKEN` PAT secrets or anything GitHub-specific. +Do **not** carry over `GITHUB_TOKEN` PAT secrets or anything GitHub-specific. That includes a github.com token for Renovate: none is needed (§4.2). ### 3.7 Verification (agent side) @@ -227,12 +241,13 @@ Schedules: Needs pilot verification: Secrets/variables to create: Maintainer steps: - 1. Review & merge chore/gitea-migration + 1. Review & merge chore/gitea-migration (a new, empty repo has no main to merge into: §6) 2. Create secrets / variables 3. Repo Settings → enable Actions (was disabled during import) 4. Qodana Cloud: set VCS URL to https://git.poli0981.dev/poli0981/.git 5. GitLab mirror: run setup-mirrors.ps1 -Only if the repo is not mirrored yet - 6. + 6. Renovate: maintainer/gitea-repo-setup.ps1 -Only (renovate-bot as Write collaborator, labels dependencies + security; §3.5) + 7. Open questions: <…> ``` @@ -245,11 +260,15 @@ Open questions: <…> - Move all 13 reusable workflows to `.gitea/workflows/`. Gitea 1.27+ expands reusable workflows server-side (nested calls, inputs, outputs, matrix supported); cross-instance URLs are not supported. - Apply §3.2 rules to each. Drop macOS/Swift jobs (keep the files for future, disabled with a header comment). - Replace caller-side assumptions (`github.event.repository.*` fields that Gitea may not populate) with explicit `inputs`. **VERIFY** per workflow. -- Tag releases of the ops repo (`vYYYY.MM.N`) and have callers pin the **commit SHA** of the tag. +- Tag releases of the ops repo (`vYYYY.MM.N`) and have callers pin the **commit SHA** of the tag. `v2026.11.1` (2026-11-23) predates the notifier fix; tag the next release after merging, and pin that. +- How Gitea runs a called workflow (source): it expands the call on the server. `owner/repo/…@ref` reads that repo on this instance, never `DEFAULT_ACTIONS_URL`. `./…` inside a called workflow resolves to the called workflow's own repo and commit, so the ops reusables call each other with `./`. A job-level `if:` sees the caller's `github.event_name`. Called jobs get only the secrets in the caller's `secrets:` map, plus the job token. +- `workflow_run` on Gitea (source): `workflow_run` has no `name` and no `head_commit`, and `head_branch` is empty for tag runs. Use `github.event.workflow.name`, `workflow_run.display_title` (the commit title) and the ref after `@` in `workflow_run.path`. The ops notifiers do. +- `.gitea/workflows/ops-lint.yml` lints every workflow here (actionlint + shellcheck; `.github/actionlint.yaml` ignores only the Gitea features actionlint does not know) and the Python. +- `renovate.json` lets Renovate bump the actions pinned here. Tools downloaded by SHA-256 (gitleaks, Opengrep, osv-scanner, cargo-deny, rclone, Qodana CLI, actionlint, shellcheck) are bumped by hand, version and checksum together. ### 4.2 `poli0981/renovate-config` (new repo) -`default.json`: +`default.json` (as shipped 2026-11-23): ```json { "$schema": "https://docs.renovatebot.com/renovate-schema.json", @@ -261,17 +280,47 @@ Open questions: <…> "timezone": "Asia/Ho_Chi_Minh", "osvVulnerabilityAlerts": true, "labels": ["dependencies"], - "dependencyDashboard": true + "dependencyDashboard": { "enabled": true, "osvVulnerabilitySummary": "unresolved" }, + "vulnerabilityAlerts": { "labels": ["dependencies", "security"] }, + "packageRules": [ + { + "description": "No github.com token on the runner, and GitHub's API refuses unauthenticated tag lookups: read the tags over git (ls-remote) instead. Our own repos live on Gitea and are never looked up on github.com.", + "matchDatasources": ["github-tags"], + "matchPackageNames": ["!poli0981/**"], + "overrideDatasource": "git-tags", + "overridePackageName": "https://github.com/{{packageName}}" + }, + { + "description": "Actions pinned to a branch (`@ # main`) go through the github-digest datasource, which also needs GitHub's API: read the branch head over git (ls-remote) instead.", + "matchDatasources": ["github-digest"], + "matchPackageNames": ["!poli0981/**"], + "overrideDatasource": "git-refs", + "overridePackageName": "https://github.com/{{packageName}}" + }, + { + "description": "Supply-chain buffer: a new npm, NuGet, crates.io or PyPI release is proposed only once it is 3 days old. Not applied to git-tags/git-refs (the github.com lookups above) or docker: git has no release timestamps, docker has them only on Docker Hub (not ghcr.io), and minimumReleaseAgeBehaviour's default (timestamp-required) would hold an update without one forever. Security PRs are exempt: vulnerabilityAlerts sets minimumReleaseAge to null, and OSV fixes apply that config.", + "matchDatasources": ["npm", "nuget", "crate", "pypi"], + "minimumReleaseAge": "3 days" + } + ] } ``` -No `schedule` key: Renovate only runs when the runner workflow below runs, and a late start (PC switched on late) must not be blocked by a time window. +No `schedule` key: Renovate only runs when the runner workflow below runs, and a late start (PC switched on late) must not be blocked by a time window. `dependencyDashboard` is an object since Renovate 44: the boolean form fails `renovate-config-validator --strict`. -Runner workflow `.gitea/workflows/renovate.yml` in the same repo: runs self-hosted Renovate (Docker image or `npx renovate`) on `ubuntu-latest`, cron `31 13 * * *` (20:31 Vietnam) plus `workflow_dispatch`, with: +Runner workflow `.gitea/workflows/renovate.yml` in the same repo: runs self-hosted Renovate on `ubuntu-latest`, cron `31 13 * * *` (20:31 Vietnam) plus `workflow_dispatch`, with: +- The job inside Renovate's own image, `ghcr.io/renovatebot/renovate:@sha256:`: the slim (containerbase) image installs each repo's lockfile tools at runtime. act replaces a job container's ENTRYPOINT, so the step runs `/usr/local/sbin/renovate-entrypoint.sh renovate` itself (**VERIFY**). The repo's own `renovate.json` keeps the image pin current. - `RENOVATE_PLATFORM=gitea`, `RENOVATE_ENDPOINT=https://git.poli0981.dev/api/v1`, `RENOVATE_AUTODISCOVER=true`, `RENOVATE_AUTODISCOVER_FILTER=poli0981/*` - `RENOVATE_TOKEN` = PAT of a dedicated `renovate-bot` user (scopes: repository R/W, user R, issue R/W, organization R). Maintainer creates the user and PAT. - `RENOVATE_GIT_AUTHOR="Renovate Bot "` +- `RENOVATE_GITHUB_TOKEN_WARN=false`: a global-only option, so it lives here and not in the preset (see below). - `concurrency: renovate` so a late run and a manual run never overlap. +**github.com without a token** (nothing GitHub-specific, §3.6). With no github.com token, Renovate skips every `github-tags` / `github-releases` dependency as `github-token-required`, every action pin included. The fix has two parts, and needs both: `RENOVATE_GITHUB_TOKEN_WARN=false` lets those dependencies reach the lookup, and the preset's package rule sends it to `git-tags` (`git ls-remote`, with annotated tags resolved to their commit). The switch alone fails, because `github-tags` asks GitHub's GraphQL API, which refuses unauthenticated calls (403). Measured 2026-11-23 on ticktune's 7 workflows under `.gitea/workflows`: 38 of 38 action pins resolved, no call to `api.github.com`. Still not covered: a `github-releases` dependency fails, visibly on the Dependency Dashboard, and PRs get no release notes from GitHub. Actions pinned to a branch (`@ # main`) go through `github-digest`, which needs the API too; the second rule reads the branch head over git (`git-refs`). + +**Vulnerabilities.** OSV alerts open their own PRs, labelled `dependencies` + `security`, without the 3-day release age that holds every other npm, NuGet, crates.io and PyPI update; the Dependency Dashboard lists the open advisories. + +**Which repos.** Gitea autodiscovery lists the repos the bot owns or collaborates on, and Renovate keeps the ones it can push to. So add `renovate-bot` as a **Write** collaborator on each repo (`poli0981` is a user, not an org: there are no teams). Create the labels `dependencies` and `security` in each repo: Renovate drops a missing label silently. `maintainer/gitea-repo-setup.ps1` (ops repo) does both steps for every repo; run it with `-DryRun` first. Onboarding stays on. A repo the bot can see without a `renovate.json` gets a "Configure Renovate" PR that proposes `local>poli0981/renovate-config`, because Renovate finds the preset by this repo's name. + ### 4.3 `security.yml` (reusable) Inputs: `rust` (bool), `node` (bool), `dotnet` (bool), `python` (bool). Jobs on `ubuntu-latest` unless noted: @@ -297,6 +346,20 @@ For uploads that are not done by `vpk` (Tauri, extension zips, other files). - Steps: `rclone copy r2:poli0981-releases//` (never `sync`, never `delete`), then `rclone copyto` each feed file, then `curl -fsSI https://releases.poli0981.dev//` as a smoke test. - Permissions: `contents: read` only. +### 4.5 `reusable-qodana.yml` (reusable, new) + +Qodana CLI scan for any stack; replaces `JetBrains/qodana-action`. + +- Inputs: `runs-on` (`ubuntu-latest` | `windows-latest`), `linter`, `config`, `project-dir`, `package-manager` (`none` | `npm` | `pnpm`; installs with scripts off), `node-version` / `node-version-file`, `dotnet-version` / `dotnet-global-json-file`, `prepare-command`, `within-docker`, `artifact-name`. Secret: `QODANA_TOKEN`. +- Native mode by default. `within-docker: true` is for linters without one (`qodana-rust`): on `windows-latest` Docker Desktop runs the image (**VERIFY**). +- CLI pinned and SHA-256 verified; the report stays an artifact (no code-scanning UI); runs started by `renovate-bot` skip the job. + +### 4.6 Tools and maintainer scripts in the ops repo + +- `tools/migration-inventory.py`: the read-only inventory of §3.1. +- `maintainer/gitea-repo-setup.ps1`: for every repo of `poli0981`, add `renovate-bot` as a Write collaborator and create the labels `dependencies` + `security` (`-DryRun`, `-Only`, `-Exclude`). Token: repository Read and Write, issue Read and Write, user Read. +- [`migration/`](migration/README.md): per-repo guides, the cron-slot registry, the shared decisions D1–D7 and the `gh` → Gitea API table. + --- ## 5. Stack profiles @@ -356,8 +419,13 @@ For uploads that are not done by `vpk` (Tauri, extension zips, other files). - `permissions`: supported for `GITEA_TOKEN` with Gitea scopes (`code`, `releases`, `wiki`, `projects` added; GitHub-only scopes unsupported). - Artifacts v4: server supports it; use the patched Gitea artifact actions (§3.2). - Schedules: cron is evaluated in UTC unless a `TZ=` prefix is given; only the default branch's workflows are scheduled. Jobs nobody picks up stay "waiting" and are cancelled after `ABANDONED_JOB_TIMEOUT` (24 h default). +- Empty repos: the first branch pushed to an empty repo becomes its default branch, so its scheduled workflows are the ones that run. Seen 2026-11-23 on `renovate-config`: `HEAD` is `chore/gitea-migration` and there is no `main`. For a new repo, create `main` from the reviewed branch (`git push origin :main`), make it the default branch, then delete the branch. +- Job containers (`jobs..container`): act replaces the image's ENTRYPOINT with its own keep-alive command. An image that needs its entrypoint must have it called from a step, as Renovate's is (§4.2). **VERIFY**. - Fork PRs: never run on the host-mode Windows runner without review. -- Issue templates: `.gitea/ISSUE_TEMPLATE` is native; `.github/ISSUE_TEMPLATE` **VERIFY** before deleting. GitLab only reads `.gitlab/issue_templates/*.md` and `.gitlab/merge_request_templates/*.md`. +- Events caused by the job token start no workflow: Gitea skips the Actions user, as GitHub skips `GITHUB_TOKEN` (scheduled workflows are still refreshed). A release or PR made by CI triggers nothing. `workflow_dispatch` through the API starts a run whoever calls it; the job token needs `actions: write` (source). +- The job token reads any public repo of the instance; another private repo only with the owner's cross-repo Actions setting (source). +- Run links `/{owner}/{repo}/actions/runs/{id}` take the run ID; old run-number links redirect (source). +- Issue templates: Gitea reads `.gitea/ISSUE_TEMPLATE`, `.github/ISSUE_TEMPLATE` and `.github/issue_template` (source). GitLab only reads `.gitlab/issue_templates/*.md` and `.gitlab/merge_request_templates/*.md`. - Push mirror to GitLab: Gitea force-pushes all branches and tags (deletions included) after each push and every 8 h. GitLab protects the default branch against force pushes, so rewriting `main` on Gitea makes the mirror fail (`last_error`) until fixed on GitLab. LFS objects are pushed too. --- @@ -371,11 +439,14 @@ For uploads that are not done by `vpk` (Tauri, extension zips, other files). 3. **Mirrors:** every public, non-archived repo gets a push mirror to GitLab (`setup-mirrors.ps1`), except `.github` and `.profile` unless renamed with `-NameMap`. 4. **Scheduled jobs:** run only 13:00–16:00 UTC (20:00–23:00 Vietnam) while the PC is on; delays from power cuts and similar are accepted. No Workers Cron or VPS jobs for now. +Also resolved (2026-11-23): **Renovate and github.com.** No github.com token; Renovate reads github.com tags over git (§4.2). + ### Open (agent: do not decide, only flag) 5. **Existing users on GitHub update feeds:** announcement text and where (poli0981.dev, SoftHarbor, README of a GitHub bridge release if the account is ever restored). 6. **Ops repo name:** keep `.github` (least churn) or rename later (e.g. `ci`); Gitea 28 also supports owner-level workflows, evaluate after the migration. 7. **Web deploys while the PC is off (optional):** Cloudflare Workers Builds can connect to the GitLab mirror and build on Cloudflare instead of the PC. Default remains `wrangler deploy` from Gitea CI. +8. **Shared decisions for the remaining repos** (Sonar, triage, web deploys, project-local CI, bot PRs, branch protection, GitHub-only extras): [`migration/README.md`](migration/README.md) D1–D7. --- @@ -383,10 +454,19 @@ For uploads that are not done by `vpk` (Tauri, extension zips, other files). | Repo | Profile | Migrated branch | Secrets set | Actions on | CI green | Release path OK | GitLab mirror | Cron slots (UTC) | |---|---|---|---|---|---|---|---|---| -| `.github` (ops) | ops | ☐ | ☐ | ☐ | ☐ | n/a | excluded | – | -| `renovate-config` | ops | ☐ | ☐ | ☐ | ☐ | n/a | ☐ | `31 13 * * *` (Renovate) | -| ticktune (pilot) | web | ☐ | ☐ | ☐ | ☐ | n/a | ☐ | | -| … | | | | | | | | | +| `.github` (ops) | ops | ☑ merged | ☐ | ☐ | ☐ | n/a | excluded | `7 14 * * 0` (weekly digest) | +| `renovate-config` | ops | ☑ merged | ☑ | ☑ | ☑ first run 2026-11-23 | n/a | ☐ | `31 13 * * *` (Renovate) | +| ticktune (pilot) | web | ☑ not merged | ☐ | ☐ | ☐ | n/a | ☐ | `37 14 * * 1`, `13 15 * * 1`, `29 15 * * 3` | +| pipdock | tauri | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | proposed in [migration/](migration/README.md) | +| frameledger | dotnet | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | proposed | +| OmniDeck | dotnet | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | proposed | +| bookmarkmagic | extension | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | proposed | +| softharbor | web | ☐ | ☐ | ☐ | ☐ | n/a | ☐ | proposed | +| poli0981-dev | web | ☐ | ☐ | ☐ | ☐ | n/a | ☐ | proposed | +| tilepier | web | ☐ | ☐ | ☐ | ☐ | n/a | ☐ | proposed | +| … (not inventoried yet) | | | | | | | | | + +The cron slots themselves are registered in [migration/README.md](migration/README.md#cron-slots-utc--the-registry). --- 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:[