Compare commits
11
Commits
v2026.11.1
...
v2026.11.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e6582af9a | ||
|
|
a133c85607
|
||
|
|
79b57af093
|
||
|
|
fd04dfe08f
|
||
|
|
50e7724cb5
|
||
|
|
c09a89c4be
|
||
|
|
cd34ce42c7
|
||
|
|
f70468e995
|
||
|
|
a008740625 | ||
|
|
e8952ee548
|
||
|
|
13dd8434cf
|
No files matched your search
@@ -14,7 +14,8 @@ name: Reusable — Announce Release to Discord
|
||||
# uses: poli0981/.github/.gitea/workflows/announce-release.yml@<full-sha> # ops vYYYY.MM.N
|
||||
# with:
|
||||
# tag_override: ${{ inputs.tag }}
|
||||
# secrets: # explicit; `secrets: inherit` is VERIFY on Gitea
|
||||
# ops_ref: <full-sha> # the same SHA as `uses:`
|
||||
# secrets: # explicit, as the runbook asks (Gitea also has `inherit`)
|
||||
# DISCORD_RELEASES_WEBHOOK: ${{ secrets.DISCORD_RELEASES_WEBHOOK }}
|
||||
# DISCORD_REPO_WEBHOOK: ${{ secrets.DISCORD_REPO_WEBHOOK }}
|
||||
# DISCORD_PING_ROLE_ID: ${{ secrets.DISCORD_PING_ROLE_ID }}
|
||||
@@ -23,7 +24,9 @@ name: Reusable — Announce Release to Discord
|
||||
# (GET {api_url}/repos/{owner}/{repo}/releases/tags/{tag}, same field names as GitHub)
|
||||
# instead of `gh api`. Gitea releases carry notes + links only (no binaries), so the
|
||||
# "Downloads" field is normally empty — the links are in the release body.
|
||||
# VERIFY: the job token can read poli0981/.github from a caller repo (sparse checkout below).
|
||||
# The job token reads poli0981/.github from a caller repo because that repo is public: Gitea
|
||||
# gives every job token read access to public repos. Making it private needs the owner-level
|
||||
# cross-repo Actions setting instead.
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
@@ -32,6 +35,10 @@ on:
|
||||
description: "Optional tag (when re-running manually)"
|
||||
type: string
|
||||
default: ""
|
||||
ops_ref:
|
||||
description: "Ref of poli0981/.github the notifier script is loaded from: pass the SHA pinned in `uses:`"
|
||||
type: string
|
||||
default: "main"
|
||||
secrets:
|
||||
DISCORD_RELEASES_WEBHOOK:
|
||||
required: false
|
||||
@@ -54,7 +61,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
repository: poli0981/.github
|
||||
ref: main
|
||||
ref: ${{ inputs.ops_ref }}
|
||||
path: ops
|
||||
sparse-checkout: |
|
||||
.github/scripts
|
||||
@@ -63,7 +70,7 @@ jobs:
|
||||
- name: Resolve release data (Gitea API)
|
||||
id: release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
API_URL: ${{ github.api_url }}
|
||||
INPUT_TAG: ${{ inputs.tag_override }}
|
||||
EVENT_TAG: ${{ github.event.release.tag_name }}
|
||||
|
||||
@@ -16,14 +16,17 @@ name: Reusable — Notify CI Failures to Discord
|
||||
# uses: poli0981/.github/.gitea/workflows/notify-ci-failure.yml@<full-sha> # ops vYYYY.MM.N
|
||||
# with:
|
||||
# default_branch: main
|
||||
# secrets: # explicit; `secrets: inherit` is VERIFY on Gitea
|
||||
# ops_ref: <full-sha> # the same SHA as `uses:`
|
||||
# secrets: # explicit, as the runbook asks (Gitea also has `inherit`)
|
||||
# DISCORD_CI_WEBHOOK: ${{ secrets.DISCORD_CI_WEBHOOK }}
|
||||
#
|
||||
# Gitea port 2026-11-23:
|
||||
# - VERIFY: `workflow_run` triggers and the github.event.workflow_run.* payload on Gitea 28.
|
||||
# - Gitea's workflow_run payload is not GitHub's (read from the Gitea source, VERIFY on
|
||||
# 28.4.0): `workflow_run` has no `name` and no `head_commit`, and head_branch is empty
|
||||
# for tag runs. The workflow name is github.event.workflow.name, the commit title
|
||||
# workflow_run.display_title, and the ref the end of workflow_run.path ("<file>@<ref>").
|
||||
# - github.event.repository.default_branch → explicit input `default_branch` (runbook §4.1).
|
||||
# - VERIFY: the run link built by discord_notify.py ({server_url}/{repo}/actions/runs/{id})
|
||||
# opens the right run on Gitea.
|
||||
# - Run link {server_url}/{repo}/actions/runs/{id}: Gitea looks run IDs up first.
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
@@ -38,6 +41,10 @@ on:
|
||||
description: "Caller repo default branch (Gitea may not populate github.event.repository)"
|
||||
type: string
|
||||
default: "main"
|
||||
ops_ref:
|
||||
description: "Ref of poli0981/.github the notifier script is loaded from: pass the SHA pinned in `uses:`"
|
||||
type: string
|
||||
default: "main"
|
||||
secrets:
|
||||
DISCORD_CI_WEBHOOK:
|
||||
required: true
|
||||
@@ -50,19 +57,19 @@ jobs:
|
||||
notify:
|
||||
if: >
|
||||
github.event.workflow_run.conclusion == 'failure' &&
|
||||
!startsWith(github.event.workflow_run.name, 'Notify') &&
|
||||
!startsWith(github.event.workflow_run.name, 'Announce') &&
|
||||
!startsWith(github.event.workflow.name, 'Notify') &&
|
||||
!startsWith(github.event.workflow.name, 'Announce') &&
|
||||
(
|
||||
inputs.skip_dedicated_workflows == false ||
|
||||
(
|
||||
!contains(github.event.workflow_run.name, 'odeQL') &&
|
||||
!contains(github.event.workflow_run.name, 'ependabot') &&
|
||||
!contains(github.event.workflow_run.name, 'enovate') &&
|
||||
!contains(github.event.workflow_run.name, 'ependency') &&
|
||||
!contains(github.event.workflow_run.name, 'eploy') &&
|
||||
!contains(github.event.workflow_run.name, 'ages') &&
|
||||
!contains(github.event.workflow_run.name, 'elease') &&
|
||||
!contains(github.event.workflow_run.name, 'esktop')
|
||||
!contains(github.event.workflow.name, 'odeQL') &&
|
||||
!contains(github.event.workflow.name, 'ependabot') &&
|
||||
!contains(github.event.workflow.name, 'enovate') &&
|
||||
!contains(github.event.workflow.name, 'ependency') &&
|
||||
!contains(github.event.workflow.name, 'eploy') &&
|
||||
!contains(github.event.workflow.name, 'ages') &&
|
||||
!contains(github.event.workflow.name, 'elease') &&
|
||||
!contains(github.event.workflow.name, 'esktop')
|
||||
)
|
||||
) &&
|
||||
(
|
||||
@@ -83,7 +90,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
repository: poli0981/.github
|
||||
ref: main
|
||||
ref: ${{ inputs.ops_ref }}
|
||||
path: ops
|
||||
sparse-checkout: |
|
||||
.github/scripts
|
||||
@@ -92,13 +99,13 @@ jobs:
|
||||
- name: Post failure to Discord
|
||||
env:
|
||||
DISCORD_CI_WEBHOOK: ${{ secrets.DISCORD_CI_WEBHOOK }}
|
||||
WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
|
||||
WORKFLOW_NAME: ${{ github.event.workflow.name }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
RUN_NUMBER: ${{ github.event.workflow_run.run_number }}
|
||||
RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }}
|
||||
BRANCH: ${{ github.event.workflow_run.head_branch }}
|
||||
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||
COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }}
|
||||
COMMIT_MESSAGE: ${{ github.event.workflow_run.display_title }}
|
||||
ACTOR: ${{ github.event.workflow_run.actor.login }}
|
||||
EVENT_NAME: ${{ github.event.workflow_run.event }}
|
||||
run: python3 ops/.github/scripts/discord_notify.py failure
|
||||
@@ -13,6 +13,7 @@ name: Reusable — Notify Deploy Status to Discord
|
||||
# uses: poli0981/.github/.gitea/workflows/notify-deploy.yml@<full-sha> # ops vYYYY.MM.N
|
||||
# with:
|
||||
# deploy_url: https://example.poli0981.dev # live site shown on success (optional)
|
||||
# ops_ref: <full-sha> # the same SHA as `uses:`
|
||||
# secrets:
|
||||
# DISCORD_CI_WEBHOOK: ${{ secrets.DISCORD_CI_WEBHOOK }}
|
||||
#
|
||||
@@ -20,7 +21,10 @@ name: Reusable — Notify Deploy Status to Discord
|
||||
# - The GitHub Pages lookup (`gh api repos/.../pages`) is removed — Pages does not exist on
|
||||
# Gitea and sites deploy to Cloudflare Workers. Pass the live URL with `deploy_url`.
|
||||
# - github.event.repository.default_branch → explicit input `default_branch` (runbook §4.1).
|
||||
# - VERIFY: `workflow_run` triggers and payload on Gitea 28.
|
||||
# - Gitea's workflow_run payload is not GitHub's (read from the Gitea source, VERIFY on
|
||||
# 28.4.0): `workflow_run` has no `name` and no `head_commit`, and head_branch is empty
|
||||
# for tag runs. The workflow name is github.event.workflow.name, the commit title
|
||||
# workflow_run.display_title, and the ref the end of workflow_run.path ("<file>@<ref>").
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
@@ -33,6 +37,10 @@ on:
|
||||
description: "Caller repo default branch (Gitea may not populate github.event.repository)"
|
||||
type: string
|
||||
default: "main"
|
||||
ops_ref:
|
||||
description: "Ref of poli0981/.github the notifier script is loaded from: pass the SHA pinned in `uses:`"
|
||||
type: string
|
||||
default: "main"
|
||||
secrets:
|
||||
DISCORD_CI_WEBHOOK:
|
||||
required: true
|
||||
@@ -46,14 +54,14 @@ jobs:
|
||||
if: >
|
||||
(github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure') &&
|
||||
(
|
||||
contains(github.event.workflow_run.name, 'eploy') ||
|
||||
contains(github.event.workflow_run.name, 'ages') ||
|
||||
contains(github.event.workflow_run.name, 'ublish')
|
||||
contains(github.event.workflow.name, 'eploy') ||
|
||||
contains(github.event.workflow.name, 'ages') ||
|
||||
contains(github.event.workflow.name, 'ublish')
|
||||
) &&
|
||||
!startsWith(github.event.workflow_run.name, 'Notify') &&
|
||||
!contains(github.event.workflow_run.name, 'odeQL') &&
|
||||
!contains(github.event.workflow_run.name, 'ependabot') &&
|
||||
!contains(github.event.workflow_run.name, 'enovate') &&
|
||||
!startsWith(github.event.workflow.name, 'Notify') &&
|
||||
!contains(github.event.workflow.name, 'odeQL') &&
|
||||
!contains(github.event.workflow.name, 'ependabot') &&
|
||||
!contains(github.event.workflow.name, 'enovate') &&
|
||||
(
|
||||
github.event.workflow_run.head_branch == inputs.default_branch ||
|
||||
github.event.workflow_run.head_branch == 'main' ||
|
||||
@@ -69,7 +77,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
repository: poli0981/.github
|
||||
ref: main
|
||||
ref: ${{ inputs.ops_ref }}
|
||||
path: ops
|
||||
sparse-checkout: |
|
||||
.github/scripts
|
||||
@@ -78,7 +86,7 @@ jobs:
|
||||
- name: Detect deploy target from workflow name
|
||||
id: target
|
||||
env:
|
||||
WF_NAME: ${{ github.event.workflow_run.name }}
|
||||
WF_NAME: ${{ github.event.workflow.name }}
|
||||
run: |
|
||||
TARGET="Deploy"
|
||||
# Later matches win. No GitHub Pages on Gitea; sites deploy to Cloudflare Workers.
|
||||
@@ -95,11 +103,11 @@ jobs:
|
||||
DEPLOY_STATUS: ${{ github.event.workflow_run.conclusion }}
|
||||
DEPLOY_TARGET: ${{ steps.target.outputs.target }}
|
||||
DEPLOY_URL: ${{ github.event.workflow_run.conclusion == 'success' && inputs.deploy_url || '' }}
|
||||
WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
|
||||
WORKFLOW_NAME: ${{ github.event.workflow.name }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
RUN_NUMBER: ${{ github.event.workflow_run.run_number }}
|
||||
BRANCH: ${{ github.event.workflow_run.head_branch }}
|
||||
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||
COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }}
|
||||
COMMIT_MESSAGE: ${{ github.event.workflow_run.display_title }}
|
||||
ACTOR: ${{ github.event.workflow_run.actor.login }}
|
||||
run: python3 ops/.github/scripts/discord_notify.py deploy
|
||||
@@ -11,14 +11,26 @@ name: Reusable — Notify Release Pipeline to Discord
|
||||
# jobs:
|
||||
# notify:
|
||||
# uses: poli0981/.github/.gitea/workflows/notify-release-pipeline.yml@<full-sha> # ops vYYYY.MM.N
|
||||
# with:
|
||||
# ops_ref: <full-sha> # the same SHA as `uses:`
|
||||
# secrets:
|
||||
# DISCORD_RELEASE_PIPELINE_WEBHOOK: ${{ secrets.DISCORD_RELEASE_PIPELINE_WEBHOOK }}
|
||||
#
|
||||
# Gitea port 2026-11-23: VERIFY `workflow_run` triggers on Gitea 28 and that head_branch
|
||||
# carries the tag name (v*) for tag-push runs, as on GitHub.
|
||||
# Gitea port 2026-11-23:
|
||||
# - Gitea's workflow_run payload is not GitHub's (read from the Gitea source, VERIFY on
|
||||
# 28.4.0): `workflow_run` has no `name` and no `head_commit`, and head_branch is empty
|
||||
# for tag runs. The workflow name is github.event.workflow.name, the commit title
|
||||
# workflow_run.display_title, and the ref the end of workflow_run.path ("<file>@<ref>").
|
||||
# - So tag runs are recognised by "@refs/tags/v" in workflow_run.path, and the tag is cut
|
||||
# from it (step "Resolve release tag").
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ops_ref:
|
||||
description: "Ref of poli0981/.github the notifier script is loaded from: pass the SHA pinned in `uses:`"
|
||||
type: string
|
||||
default: "main"
|
||||
secrets:
|
||||
DISCORD_RELEASE_PIPELINE_WEBHOOK:
|
||||
required: true
|
||||
@@ -31,18 +43,18 @@ jobs:
|
||||
notify:
|
||||
if: >
|
||||
(
|
||||
contains(github.event.workflow_run.name, 'elease') ||
|
||||
contains(github.event.workflow_run.name, 'esktop')
|
||||
contains(github.event.workflow.name, 'elease') ||
|
||||
contains(github.event.workflow.name, 'esktop')
|
||||
) &&
|
||||
!startsWith(github.event.workflow_run.name, 'Notify') &&
|
||||
!startsWith(github.event.workflow_run.name, 'Announce') &&
|
||||
!contains(github.event.workflow_run.name, 'odeQL') &&
|
||||
!contains(github.event.workflow_run.name, 'ependabot') &&
|
||||
!startsWith(github.event.workflow.name, 'Notify') &&
|
||||
!startsWith(github.event.workflow.name, 'Announce') &&
|
||||
!contains(github.event.workflow.name, 'odeQL') &&
|
||||
!contains(github.event.workflow.name, 'ependabot') &&
|
||||
(
|
||||
github.event.workflow_run.event == 'release' ||
|
||||
github.event.workflow_run.event == 'workflow_dispatch' ||
|
||||
startsWith(github.event.workflow_run.head_branch, 'v') ||
|
||||
startsWith(github.event.workflow_run.head_branch, 'desktop-v')
|
||||
contains(github.event.workflow_run.path, '@refs/tags/v') ||
|
||||
contains(github.event.workflow_run.path, '@refs/tags/desktop-v')
|
||||
) &&
|
||||
(
|
||||
github.event.workflow_run.conclusion == 'success' ||
|
||||
@@ -59,7 +71,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
repository: poli0981/.github
|
||||
ref: main
|
||||
ref: ${{ inputs.ops_ref }}
|
||||
path: ops
|
||||
sparse-checkout: |
|
||||
.github/scripts
|
||||
@@ -68,7 +80,7 @@ jobs:
|
||||
- name: Detect packager
|
||||
id: detect
|
||||
env:
|
||||
WF_NAME: ${{ github.event.workflow_run.name }}
|
||||
WF_NAME: ${{ github.event.workflow.name }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
PACKAGER=""
|
||||
@@ -82,13 +94,28 @@ jobs:
|
||||
esac
|
||||
echo "packager=$PACKAGER" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Resolve release tag
|
||||
id: tag
|
||||
env:
|
||||
WF_PATH: ${{ github.event.workflow_run.path }} # "<file>.yml@<ref>" on Gitea
|
||||
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# Gitea leaves head_branch empty for tag runs; the ref is the end of workflow_run.path.
|
||||
ref="${WF_PATH#*@}"
|
||||
case "$ref" in
|
||||
refs/tags/*) tag="${ref#refs/tags/}" ;;
|
||||
*) tag="$HEAD_BRANCH" ;;
|
||||
esac
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Post release pipeline status
|
||||
env:
|
||||
DISCORD_RELEASE_PIPELINE_WEBHOOK: ${{ secrets.DISCORD_RELEASE_PIPELINE_WEBHOOK }}
|
||||
BUILD_STATUS: ${{ github.event.workflow_run.conclusion }}
|
||||
BUILD_PLATFORM: ${{ github.event.workflow_run.event }}
|
||||
BUILD_PACKAGER: ${{ steps.detect.outputs.packager }}
|
||||
RELEASE_TAG: ${{ github.event.workflow_run.head_branch }}
|
||||
WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
|
||||
RELEASE_TAG: ${{ steps.tag.outputs.tag }}
|
||||
WORKFLOW_NAME: ${{ github.event.workflow.name }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
run: python3 ops/.github/scripts/discord_notify.py release-build
|
||||
@@ -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
|
||||
@@ -39,7 +39,8 @@
|
||||
# stale feed — the job fails before uploading anything
|
||||
# - rclone pinned + SHA-256 verified; configured only through env vars, with an empty
|
||||
# config file so the host-mode Windows runner never picks up a local rclone.conf
|
||||
# - runs only for tag pushes (refs/tags/v*) or workflow_dispatch (runbook §2 rule 10)
|
||||
# - runs only on a v* tag: a tag push, or workflow_dispatch started on that tag
|
||||
# (runbook §2 rule 10), the same guard as the release jobs in the reusables
|
||||
|
||||
name: Reusable / Publish to R2
|
||||
|
||||
@@ -82,7 +83,7 @@ permissions:
|
||||
jobs:
|
||||
publish:
|
||||
# Release credentials: tag pushes or manual runs only (runbook §2 rule 10)
|
||||
if: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || github.event_name == 'workflow_dispatch' }}
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
# R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
|
||||
#
|
||||
# Gitea port 2026-11-23: ubuntu-latest = Docker image docker.gitea.com/runner-images.
|
||||
# VERIFY on pilot: the nested call `uses: ./.gitea/workflows/publish-r2.yml` must resolve to
|
||||
# this ops repo at the same commit. If Gitea resolves `./` against the CALLER repo, change it
|
||||
# to `poli0981/.github/.gitea/workflows/publish-r2.yml@<sha of the same ops tag>`.
|
||||
# The nested call `uses: ./.gitea/workflows/publish-r2.yml` resolves to THIS ops repo at the
|
||||
# same commit: Gitea reads `./` against the repo and commit of the file that holds the
|
||||
# `uses:`, not against the caller repo (read from the Gitea source; VERIFY on 28.4.0).
|
||||
# Actions pinned to commit SHAs (Renovate keeps them current).
|
||||
|
||||
name: Reusable / Chrome Extension
|
||||
@@ -211,7 +211,7 @@ jobs:
|
||||
if: ${{ inputs.release && startsWith(github.ref, 'refs/tags/v') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
|
||||
permissions:
|
||||
contents: read
|
||||
uses: ./.gitea/workflows/publish-r2.yml # VERIFY: resolves to this ops repo (see header)
|
||||
uses: ./.gitea/workflows/publish-r2.yml # this ops repo, same commit (see header)
|
||||
with:
|
||||
app: ${{ needs.package.outputs.app }}
|
||||
artifact: r2-release
|
||||
|
||||
@@ -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: '<m> <13-15> * * <d>' # 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@<full-sha> # 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
|
||||
@@ -10,9 +10,10 @@ name: Weekly Digest
|
||||
# Required repo secrets (set on poli0981/.github):
|
||||
# DISCORD_DIGEST_WEBHOOK — webhook for #announcements
|
||||
# OPS_GITEA_TOKEN — Gitea PAT (Settings → Applications), scopes:
|
||||
# read:repository + read:issue. The job token
|
||||
# (GITEA_TOKEN) only sees this repo, so it cannot
|
||||
# aggregate the others.
|
||||
# read:repository + read:issue + read:user
|
||||
# (GET /users/{owner}/repos needs user AND repository).
|
||||
# The job token (GITEA_TOKEN) does not see private
|
||||
# repos, so it cannot aggregate them.
|
||||
#
|
||||
# Run on demand: Actions → Weekly Digest → Run workflow
|
||||
|
||||
|
||||
@@ -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'
|
||||
@@ -441,7 +441,7 @@ def post_weekly_digest() -> int:
|
||||
|
||||
Env:
|
||||
DISCORD_DIGEST_WEBHOOK — webhook for #announcements
|
||||
OPS_GITEA_TOKEN — Gitea PAT, scopes read:repository + read:issue
|
||||
OPS_GITEA_TOKEN — Gitea PAT, scopes read:repository + read:issue + read:user
|
||||
(the job token only sees its own repo)
|
||||
GH_OWNER — owner username (default: owner part of GITHUB_REPOSITORY)
|
||||
GITEA_API_URL — API root, e.g. https://git.poli0981.dev/api/v1
|
||||
@@ -473,7 +473,13 @@ def post_weekly_digest() -> int:
|
||||
]
|
||||
|
||||
# Releases: no cross-repo endpoint, so list them per repo and filter by published_at.
|
||||
repos = _gitea_paged(base, f"/users/{quote(owner, safe='')}/repos", token)
|
||||
try:
|
||||
repos = _gitea_paged(base, f"/users/{quote(owner, safe='')}/repos", token)
|
||||
except HTTPError as e:
|
||||
if e.code in (401, 403):
|
||||
print("[ERROR] OPS_GITEA_TOKEN cannot list the repos: GET /users/{owner}/repos needs "
|
||||
"the scopes read:user + read:repository.")
|
||||
return 1
|
||||
releases_by_repo: dict[str, list[dict]] = defaultdict(list)
|
||||
for repo in repos:
|
||||
repo_full = repo.get("full_name", "")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.idea/
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
|
||||
@@ -0,0 +1,493 @@
|
||||
# Gitea Migration Runbook (GitHub → git.poli0981.dev)
|
||||
|
||||
> **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, 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.
|
||||
|
||||
---
|
||||
|
||||
## 0. How to use this file
|
||||
|
||||
1. Open a session in the target repository.
|
||||
2. Tell the agent: *"Follow `GITEA-MIGRATION.md` (§3) for this repo. Work on branch `chore/gitea-migration`. Stop at §3.8 and give me the hand-off report."*
|
||||
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.
|
||||
|
||||
---
|
||||
|
||||
## 1. Fixed facts (do not change)
|
||||
|
||||
| Item | Value |
|
||||
|---|---|
|
||||
| Forge | Gitea 28.4.0, self-hosted, `https://git.poli0981.dev` (canonical home of every repo) |
|
||||
| Owner | `poli0981` (user account, not an org) |
|
||||
| HTTPS clone | `https://git.poli0981.dev/poli0981/<repo>.git` |
|
||||
| SSH clone | `ssh://git@git.poli0981.dev:2222/poli0981/<repo>.git` |
|
||||
| Web URLs | repo `https://git.poli0981.dev/poli0981/<repo>` · releases page `…/<repo>/releases` |
|
||||
| Local remotes | `origin` = Gitea. `github` = old GitHub remote (account suspended; keep, never push) |
|
||||
| Registration | Disabled on the instance. Outside people **cannot** open issues or PRs on Gitea |
|
||||
| Public mirror | `https://gitlab.com/poli0981/<repo>`: 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` 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/<name>@<ref>` |
|
||||
| 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:*`) |
|
||||
| Scheduled jobs | **Only 13:00–16:00 UTC** (20:00–23:00 Vietnam), when the PC is normally on. If the PC is off, the run waits as "waiting" and starts when the runner comes online; after 24 h unpicked it is cancelled (`ABANDONED_JOB_TIMEOUT`). Delays from power cuts etc. are accepted |
|
||||
| Maintenance window | Gitea stops for a few seconds daily for backup at **19:30–19:45 UTC** (02:30 Vietnam). Never schedule anything there (already outside the window above) |
|
||||
| Not available | macOS runners, GitHub-hosted runners, OIDC `id-token`, GitHub code scanning / SARIF UI, Dependabot, CodeQL, GitHub Pages, GitHub Packages |
|
||||
| Static analysis | Qodana (licensed). Security/deps: Opengrep, gitleaks, osv-scanner, cargo-deny, NuGetAudit (§3.5) |
|
||||
| Dependency updates | Renovate, self-hosted, central preset repo `poli0981/renovate-config` (§4.2) |
|
||||
| Release hosting | Cloudflare R2 bucket **`poli0981-releases`**, public only through **`https://releases.poli0981.dev/<app>/`** (`r2.dev` URL disabled). `<app>` = repo name in lowercase. No directory listing: link to exact files |
|
||||
| Release caching | Cloudflare cache is **bypassed** for files whose content changes under the same name: `*.json`, `RELEASES`, `*-Setup.exe`, `*-Setup.pkg`, `*-Portable.zip`, `*.AppImage`, and any name containing `-latest.` (convention for stable download aliases on any platform, e.g. `<app>-latest.apk`, `<app>-latest.dmg`). Everything else may be cached at the edge, so every other file name must be versioned and never overwritten |
|
||||
| Gitea releases | Notes + links to `releases.poli0981.dev` only. Do not attach installers or packages (server disk is 40 GB) |
|
||||
| Web hosting | Cloudflare Workers (deploy with Wrangler from Gitea CI) |
|
||||
| License | GPL-3.0 (sites: CC BY-SA 4.0 where already set) |
|
||||
|
||||
---
|
||||
|
||||
## 2. Hard rules for the agent
|
||||
|
||||
1. **Never push to the `github` remote, never delete it, never rewrite history.**
|
||||
2. **Never create, print, or commit secret values.** Only list secret *names* the maintainer must create (§3.6).
|
||||
3. **Do not enable Actions, change repo settings, or call the Gitea or GitLab API.** The maintainer does that after review.
|
||||
4. **Do not touch the server** (`/opt/gitea`, Docker, Caddy, backups) **or the GitLab mirror** (no `gitlab` remote, no pushes there).
|
||||
5. Keep the repo's conventions: GPL-3.0 headers, Clean Architecture layout, explicit `permissions:` blocks on workflows and caller stubs, EN/VI/JA `.resx` parity.
|
||||
6. **Pin every third-party action to a full 40-char commit SHA** with a version comment (`# v4.2.2`). Renovate keeps them updated. Tags alone are not acceptable (tag force-push attacks hit trivy-action in March 2026).
|
||||
7. One logical change per commit. Work only on branch `chore/gitea-migration`.
|
||||
8. If a step needs a capability listed as "Not available" in §1, **disable or remove that job and say so** in the hand-off report. Do not invent workarounds silently.
|
||||
9. Anything marked **VERIFY**: implement the documented approach, then flag it in the hand-off report as "needs pilot verification".
|
||||
10. Release credentials (`R2_RELEASES_*`, signing keys, store tokens) may only be referenced in jobs triggered by a tag push (`on: push: tags: ['v*']`) or `workflow_dispatch`, never in `pull_request` or scheduled jobs.
|
||||
|
||||
---
|
||||
|
||||
## 3. Per-repo procedure
|
||||
|
||||
### 3.1 Inventory (read-only, report the results first)
|
||||
|
||||
Run the ops repo's inventory tool from the repo root (read-only, tracked files only) and summarise it before changing anything:
|
||||
|
||||
```bash
|
||||
python3 <ops clone>/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
|
||||
git status --short
|
||||
ls -la .github .gitea .gitlab 2>/dev/null
|
||||
find .github .gitea .gitlab -type f 2>/dev/null | sort
|
||||
grep -rIn --exclude-dir={.git,node_modules,bin,obj,target,dist,.svelte-kit} \
|
||||
-e 'github\.com/poli0981' -e 'githubusercontent' -e 'api\.github\.com' \
|
||||
-e 'GithubSource' -e 'ghcr\.io' -e 'gh ' -e 'github\.io' -e '@poli0981\.dev' .
|
||||
grep -rIn -e 'uses:' -e 'runs-on:' -e 'permissions:' -e 'id-token' -e 'secrets\.' -e 'cron:' .github/workflows 2>/dev/null
|
||||
```
|
||||
|
||||
Classify the repo into one or more **stack profiles** (§5) and list every workflow with: trigger (including cron in UTC), jobs, `runs-on`, actions used, secrets used. List every e-mail address the repo already documents.
|
||||
|
||||
### 3.2 Workflows
|
||||
|
||||
1. **Move** `.github/workflows/*` → `.gitea/workflows/` (same filenames) and delete `.github/workflows/`. Keep `.github/ISSUE_TEMPLATE`, PR templates and `CODEOWNERS` where they are (see §3.4 for GitLab templates).
|
||||
2. **Delete GitHub-only workflows/config:** CodeQL (`github/codeql-action`), `.github/dependabot.yml`, dependency-review, `actions/upload-pages-artifact`/`deploy-pages`, stale-bot, GitHub-App-based bots, `github/codeql-action/upload-sarif`.
|
||||
3. **Caller stubs → ops repo.** Replace calls to `poli0981/.github/.github/workflows/<x>.yml@…` with:
|
||||
```yaml
|
||||
uses: poli0981/.github/.gitea/workflows/<x>.yml@<full-sha> # ops vYYYY.MM.N
|
||||
```
|
||||
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: <the same full-sha>`, 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 |
|
||||
|---|---|---|
|
||||
| `windows-latest`, `windows-2022/2025` | `windows-latest` | Host mode on the maintainer PC. Tools already installed there; do not `choco install` system-wide |
|
||||
| `ubuntu-latest`, `ubuntu-2x.04` | same label | Docker image `docker.gitea.com/runner-images` |
|
||||
| `macos-*` | **remove job** or guard with `if: false` + comment `# no macOS runner (Gitea)` | Report it |
|
||||
| matrix over OS | drop the macOS entries | |
|
||||
|
||||
5. **`permissions:` mapping** (keep explicit blocks, it is the repo convention):
|
||||
- Keep: `contents`, `issues`, `pull-requests`, `actions`, `packages`.
|
||||
- **Remove** (unsupported on Gitea): `id-token`, `statuses`, `checks`, `deployments`, `security-events`, `pages`, `attestations`.
|
||||
- Release jobs: add `releases: write` next to `contents: write` (**VERIFY** which one Gitea enforces).
|
||||
6. **Action replacement table** (pin SHAs, see rule 6):
|
||||
|
||||
| GitHub action | Gitea replacement |
|
||||
|---|---|
|
||||
| `actions/checkout`, `actions/setup-dotnet`, `actions/setup-node`, `actions/setup-python`, `pnpm/action-setup`, `astral-sh/setup-uv`, `dtolnay/rust-toolchain`, `actions/cache` | Keep (work on Gitea). Pin SHA |
|
||||
| `actions/upload-artifact@v4+` / `download-artifact@v4+` | `christopherhx/gitea-upload-artifact@v4` / `christopherhx/gitea-download-artifact@v4` (upstream v4 refuses to run on non-GitHub servers). **VERIFY** |
|
||||
| `softprops/action-gh-release`, `ncipollo/release-action` | `https://gitea.com/actions/gitea-release-action@<sha>` (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` | 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) |
|
||||
|
||||
7. **Expressions/contexts:** `github.repository`, `github.ref_name`, `github.sha`, `github.server_url` work. Hard-coded `https://github.com` in expressions → `${{ github.server_url }}`.
|
||||
8. **Ignored or different on Gitea:** `jobs.<id>.environment` (ignored), problem matchers/annotations (ignored), PR `ref` is `refs/pull/N/head` (no merge preview), `GITEA_TOKEN` cannot publish to the repo's own package registry (use a PAT secret if ever needed).
|
||||
9. **Schedules:**
|
||||
- Cron is **UTC**. Every `cron:` must fall inside **13:00–16:00 UTC** (20:00–23:00 Vietnam). Convert existing crons and list old → new in the hand-off report.
|
||||
- Do not use the `TZ=` prefix (Gitea supports it, GitHub tooling and actionlint do not).
|
||||
- Pick a non-round minute (e.g. `17 13 * * *`, not `0 13 * * *` or `30 13 * * *`) and do not reuse a slot already taken in §8, so jobs from different repos do not pile up on the single runner.
|
||||
- Daily or weekly only. Anything that needs to run more often than daily, or must run while the PC is off: stop and report (§7).
|
||||
- Scheduled workflows run from the default branch only.
|
||||
|
||||
### 3.3 Release & update channel
|
||||
|
||||
Releases move from GitHub Releases to **R2: `https://releases.poli0981.dev/<app>/`** (update feeds and downloads) plus an optional **Gitea release** with notes and links. Per stack:
|
||||
|
||||
- **Velopack apps:** §5.1. `UpdateManager` source → `https://releases.poli0981.dev/<app>`.
|
||||
- **Tauri apps:** §5.2. Updater endpoint → `https://releases.poli0981.dev/<app>/latest.json`.
|
||||
- **Web apps:** no release artifacts; deploy job only.
|
||||
- **Chrome extension:** store submission only; optional zip under `releases.poli0981.dev/<app>/<version>/`.
|
||||
|
||||
Rules for everything uploaded to R2:
|
||||
- Upload versioned files first, the files clients poll (`releases.*.json`, `RELEASES`, `latest.json`) **last**, so a client never sees a feed that points to files not uploaded yet.
|
||||
- Only names listed under "Release caching" in §1 may be overwritten. All other names must contain the version.
|
||||
- Never delete objects from CI, except Velopack's own `--keepMaxReleases` pruning (§5.1).
|
||||
|
||||
Existing installs still point at GitHub and **cannot be redirected** from here. Report which apps are affected (§7 item 5).
|
||||
|
||||
### 3.4 Metadata, links, docs
|
||||
|
||||
Replace `github.com/poli0981/<repo>` as follows:
|
||||
|
||||
| Kind of link | New target |
|
||||
|---|---|
|
||||
| Source, clone, homepage, `RepositoryUrl`, `repository` fields | `https://git.poli0981.dev/poli0981/<repo>` |
|
||||
| Bug report / issue / feature request links (README, `package.json` `bugs`, `pyproject` `Issues`, in-app "Report a bug") | `https://gitlab.com/poli0981/<repo>/-/issues` (new issue: `…/-/issues/new`) |
|
||||
| Download links | `https://releases.poli0981.dev/<app>/…` (exact file names, §5) |
|
||||
|
||||
Files to check:
|
||||
|
||||
- `README*.md`: badges, clone commands, issue links. Workflow badge: `https://git.poli0981.dev/poli0981/<repo>/actions/workflows/<file>.yml/badge.svg?branch=main` (**VERIFY**; Gitea's Actions page has a badge dialog). Add a short **"Where things live"** section:
|
||||
> Source: `git.poli0981.dev/poli0981/<repo>` (canonical). Mirror for issues and merge requests: `gitlab.com/poli0981/<repo>`. Patches and questions: `code@poli0981.dev`. Security: `security@poli0981.dev` (see `SECURITY.md`).
|
||||
- `.csproj` / `Directory.Build.props`: `RepositoryUrl`, `PackageProjectUrl`, `RepositoryType=git`.
|
||||
- `package.json`: `repository`, `bugs`, `homepage`. `Cargo.toml`: `repository`, `homepage`. `pyproject.toml`: `[project.urls]` (`Source` → Gitea, `Issues` → GitLab).
|
||||
- `tauri.conf.json` updater endpoints (§5.2); WXT/extension manifest `homepage_url`.
|
||||
- **In-app strings:** About/Help/"Report a bug" links in `.resx` (EN/VI/JA kept in parity), Svelte i18n files, constants. "Report a bug" → GitLab issues.
|
||||
- `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/<Name>.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.
|
||||
|
||||
### 3.5 Dependencies, security, quality
|
||||
|
||||
1. **Renovate:** add `renovate.json` at repo root:
|
||||
```json
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": ["local>poli0981/renovate-config"]
|
||||
}
|
||||
```
|
||||
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 <repo>` 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 `<NuGetAuditMode>all</NuGetAuditMode>` in `Directory.Build.props`. CI should fail on `NU1903`/`NU1904` (high/critical) only. Consider `<AnalysisMode>All</AnalysisMode>` 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`. 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).
|
||||
|
||||
### 3.6 Secrets inventory (output only)
|
||||
|
||||
Produce a table for the maintainer. Prefer **user-level** Actions secrets/variables (Gitea → Settings → Actions) for values shared by many repos; repo-level only when specific.
|
||||
|
||||
| Name | Kind | Used by | Level | Source |
|
||||
|---|---|---|---|---|
|
||||
| `QODANA_TOKEN` | secret | qodana job | repo | Qodana Cloud project |
|
||||
| `R2_RELEASES_ACCESS_KEY_ID` / `R2_RELEASES_SECRET_ACCESS_KEY` | secret | release upload | user | R2 API token, Object Read & Write on `poli0981-releases` only |
|
||||
| `R2_ACCOUNT_ID` | **variable** | release upload | user | Cloudflare account ID. Use `${{ vars.R2_ACCOUNT_ID }}`; never hard-code it |
|
||||
| `CLOUDFLARE_API_TOKEN` / `CLOUDFLARE_ACCOUNT_ID` | secret | Workers deploy | user | Cloudflare API token (Workers edit) |
|
||||
| `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. That includes a github.com token for Renovate: none is needed (§4.2).
|
||||
|
||||
### 3.7 Verification (agent side)
|
||||
|
||||
- [ ] `grep` from §3.1 shows no remaining `github.com/poli0981` except history/changelog.
|
||||
- [ ] No `.github/workflows/` left; every workflow in `.gitea/workflows/` parses (`actionlint` if available; Gitea-specific keys may warn).
|
||||
- [ ] Every `uses:` is pinned to a 40-char SHA with a version comment.
|
||||
- [ ] No `macos-*`, `id-token`, CodeQL, Dependabot, `upload-sarif`, `tauri-action`, `trivy-action` left.
|
||||
- [ ] Every `cron:` is inside 13:00–16:00 UTC, on a non-round minute, daily or weekly.
|
||||
- [ ] Release secrets appear only in tag-push / `workflow_dispatch` jobs (rule 10).
|
||||
- [ ] Issue links point to GitLab, source links to Gitea, downloads to `releases.poli0981.dev`.
|
||||
- [ ] Project builds and tests pass locally (same commands CI runs).
|
||||
- [ ] `.resx` EN/VI/JA keys still in parity if strings changed.
|
||||
- [ ] Docs (`README`, `CLAUDE.md`, `SECURITY.md`, `CONTRIBUTING.md`, `.gitlab/` templates) updated.
|
||||
|
||||
### 3.8 Commit & hand-off report
|
||||
|
||||
Commit on `chore/gitea-migration`, push to `origin` (Gitea) only. Then output:
|
||||
|
||||
```
|
||||
## Gitea migration – <repo>
|
||||
Profiles: <…>
|
||||
Changed: <files grouped by purpose>
|
||||
Removed jobs/features: <macOS, CodeQL, … and why>
|
||||
Schedules: <old cron → new cron (UTC)>
|
||||
Needs pilot verification: <VERIFY items touched>
|
||||
Secrets/variables to create: <table from §3.6>
|
||||
Maintainer steps:
|
||||
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/<repo>.git
|
||||
5. GitLab mirror: run setup-mirrors.ps1 -Only <repo> if the repo is not mirrored yet
|
||||
6. Renovate: maintainer/gitea-repo-setup.ps1 -Only <repo> (renovate-bot as Write collaborator, labels dependencies + security; §3.5)
|
||||
7. <release/R2/Workers steps if any>
|
||||
Open questions: <…>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Ops repo `poli0981/.github` (do this first)
|
||||
|
||||
### 4.1 Reusable workflows
|
||||
|
||||
- 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. `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` (as shipped 2026-11-23):
|
||||
```json
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:recommended",
|
||||
"helpers:pinGitHubActionDigests",
|
||||
"group:allNonMajor"
|
||||
],
|
||||
"timezone": "Asia/Ho_Chi_Minh",
|
||||
"osvVulnerabilityAlerts": true,
|
||||
"labels": ["dependencies"],
|
||||
"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 (`@<sha> # 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. `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 on `ubuntu-latest`, cron `31 13 * * *` (20:31 Vietnam) plus `workflow_dispatch`, with:
|
||||
- The job inside Renovate's own image, `ghcr.io/renovatebot/renovate:<version>@sha256:<digest>`: 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-bot@poli0981.dev>"`
|
||||
- `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 (`@<sha> # 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:
|
||||
|
||||
| Job | Tool | Notes |
|
||||
|---|---|---|
|
||||
| secrets | gitleaks | full history scan, redact output, fail on findings |
|
||||
| sast | Opengrep | `--taint-intrafile`, SARIF uploaded as artifact (no code-scanning UI on Gitea). Pin rule sources |
|
||||
| deps | osv-scanner | scan lockfiles (`packages.lock.json`, `pnpm-lock.yaml`, `Cargo.lock`, `uv.lock`) |
|
||||
| rust | cargo-deny | only when `rust: true` |
|
||||
| dotnet | `dotnet restore` with NuGetAudit | `windows-latest` when the solution targets `net*-windows` |
|
||||
|
||||
Pin tool versions and verify checksums when downloading binaries. Check exact CLI flags with `--help` (**VERIFY**). Callers schedule it weekly inside the window, e.g. `43 14 * * 6` (Saturday 21:43 Vietnam), staggered per repo.
|
||||
|
||||
### 4.4 `publish-r2.yml` (reusable, new)
|
||||
|
||||
For uploads that are not done by `vpk` (Tauri, extension zips, other files).
|
||||
|
||||
- Inputs: `app` (string, folder under the bucket), `versioned-dir` (path uploaded first), `feed-files` (newline list of paths uploaded last, e.g. `latest.json`), `runs-on` (default `windows-latest`).
|
||||
- Secrets: `R2_RELEASES_ACCESS_KEY_ID`, `R2_RELEASES_SECRET_ACCESS_KEY`. Variable: `R2_ACCOUNT_ID`.
|
||||
- Tool: rclone (pinned version, checksum verified), configured only through env vars, as in the server backup script:
|
||||
`RCLONE_CONFIG_R2_TYPE=s3`, `RCLONE_CONFIG_R2_PROVIDER=Cloudflare`, `RCLONE_CONFIG_R2_ENDPOINT=https://<account>.r2.cloudflarestorage.com`, `RCLONE_CONFIG_R2_REGION=auto`, `RCLONE_CONFIG_R2_NO_CHECK_BUCKET=true`, keys from secrets.
|
||||
- Steps: `rclone copy <versioned-dir> r2:poli0981-releases/<app>/` (never `sync`, never `delete`), then `rclone copyto` each feed file, then `curl -fsSI https://releases.poli0981.dev/<app>/<feed>` 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
|
||||
|
||||
### 5.1 .NET / WPF / Velopack (FrameLedger, OmniDeck, CommandForge, …)
|
||||
- Build/test/pack on `windows-latest` (host). C++ parts (FrameLedger hook engine) use the PC's existing MSVC toolchain.
|
||||
- Release job (tag push), credentials passed as env so they never appear on the command line:
|
||||
```yaml
|
||||
env:
|
||||
VPK_BUCKET: poli0981-releases
|
||||
VPK_PREFIX: <app>/ # trailing slash: objects become <app>/releases.win.json
|
||||
VPK_ENDPOINT: https://${{ vars.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com
|
||||
VPK_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
|
||||
VPK_SECRET: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
|
||||
```
|
||||
1. `vpk download s3 --channel win -o releases` (previous release, for delta packages; first release: ignore the "nothing found" result).
|
||||
2. `vpk pack -u <PackId> -v <version> -p <publish dir> -o releases …` (existing flags of the repo).
|
||||
3. `vpk upload s3 --channel win -o releases --keepMaxReleases 10`.
|
||||
- **VERIFY on the pilot:** that `vpk … s3` works against R2 with `--endpoint` only (if signing fails, try adding `--region auto`), and that the keys land under `<app>/`. If `vpk … s3` cannot talk to R2: `vpk download http --url https://releases.poli0981.dev/<app>` + `publish-r2.yml` (packages first, `releases.win.json`, `assets.win.json` and `RELEASES` last).
|
||||
- Public files: the stable-named installer and portable zip that `vpk pack` writes (`<PackId>-Setup.exe` / `<PackId>-Portable.zip`; some Velopack versions add `-win-`: copy the exact names from the pilot's `releases/` folder). Both are matched by the cache-bypass rule. Link them from README and the Gitea release notes.
|
||||
- Other platforms later: Velopack makes a `.pkg` + portable `.zip` on macOS (needs a Mac; no macOS runner) and only a portable `.AppImage` on Linux. Feeds are `releases.osx.json` / `releases.linux.json`. All of these names are already covered by the cache-bypass rule (§1).
|
||||
- App code: `new UpdateManager("https://releases.poli0981.dev/<app>")` (HTTP source). Remove `GithubSource` usage and any GitHub token logic.
|
||||
- Qodana: native mode on Windows (§3.5).
|
||||
|
||||
### 5.2 Tauri 2 + React/TS + Rust (PipDock, …)
|
||||
- Build on `windows-latest` with the Tauri CLI; `TAURI_SIGNING_PRIVATE_KEY(_PASSWORD)` env produces `.sig` files.
|
||||
- Layout in the bucket: installer + `.sig` under `<app>/<version>/` (versioned, cacheable), `latest.json` at `<app>/latest.json` (not cached). Linux/macOS builds, if added later, go in the same `latest.json` (`linux-x86_64`, `darwin-aarch64`, …) with their files under `<version>/`; no cache change needed.
|
||||
- Generate `latest.json` (Tauri v2 updater format: `version`, `notes`, `pub_date`, `platforms.windows-x86_64.{signature,url}` with `url` = `https://releases.poli0981.dev/<app>/<version>/<installer>`) with a small script; upload with `publish-r2.yml` (`versioned-dir` first, `latest.json` last).
|
||||
- `tauri.conf.json` → `plugins.updater.endpoints: ["https://releases.poli0981.dev/<app>/latest.json"]`. **Keep the same updater public key.**
|
||||
- Add `cargo deny`, `cargo clippy -- -D warnings` if not present.
|
||||
|
||||
### 5.3 Web: Astro / SvelteKit + Cloudflare Workers (poli0981.dev, SoftHarbor, TickTune, TilePier, RepoLens, freeitchgames.win)
|
||||
- CI on `ubuntu-latest`: install, lint, typecheck, build, test.
|
||||
- Deploy job on `main`: `wrangler deploy` with `CLOUDFLARE_API_TOKEN`/`CLOUDFLARE_ACCOUNT_ID`. Disconnect Cloudflare's GitHub integration for the project (maintainer, dashboard).
|
||||
- Scheduled data refresh jobs (e.g. freeitchgames.win catalog): keep as a scheduled workflow, daily, inside 13:00–16:00 UTC (decided: delays when the PC is off are accepted). Update user-facing text that promises a time (e.g. "updated daily around 20:00–23:00 Vietnam time, may be delayed").
|
||||
- **RepoLens:** data source is the GitHub API. Out of scope for a mechanical migration; open an issue/plan to add a Gitea API adapter (`/api/v1/users/poli0981/repos`).
|
||||
|
||||
### 5.4 Chrome extension: WXT + Svelte 5 (BookmarkMagic)
|
||||
- CI on `ubuntu-latest`: build + zip. Store submission stays manual or uses store API secrets (repo-level).
|
||||
- Update `homepage_url` and any "GitHub" links in the UI/store listing text kept in the repo (issues → GitLab).
|
||||
|
||||
### 5.5 Python (PipDock adapters, CommandForge for Linux, scripts)
|
||||
- CI on `ubuntu-latest` with `uv`. Ruff with `S` rules if not present (report).
|
||||
- PyPI Trusted Publishing (OIDC) is unavailable → API token secret, only if the project publishes.
|
||||
|
||||
### 5.6 Go / Swift / other stacks in the CI suite
|
||||
- Go: unchanged on `ubuntu-latest`.
|
||||
- Swift/macOS: no runner. Disable with a comment; report.
|
||||
|
||||
---
|
||||
|
||||
## 6. Known Gitea Actions & mirror behaviours (reference)
|
||||
|
||||
- Workflows directory: use `.gitea/workflows/` (official examples). Do not keep both `.github/workflows/` and `.gitea/workflows/`.
|
||||
- Reusable workflows: supported, including from private repos (1.26+) and nested (1.27+). `$/` prefix supported (28.x).
|
||||
- `concurrency`: supported (1.26+). `continue-on-error`: implemented (28.x). Older docs that say "ignored" are outdated.
|
||||
- `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 <branch>:main`), make it the default branch, then delete the branch.
|
||||
- Job containers (`jobs.<id>.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.
|
||||
- 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.
|
||||
|
||||
---
|
||||
|
||||
## 7. Maintainer decisions
|
||||
|
||||
### Resolved (November 2026)
|
||||
|
||||
1. **Release hosting:** R2 bucket `poli0981-releases`, public only via `releases.poli0981.dev`, one folder per app (§1, §3.3, §5).
|
||||
2. **Outside contributions:** through the GitLab mirror (issues, merge requests) or by e-mail (`code@`, `security@` and other addresses already in the repos). Gitea registration stays disabled.
|
||||
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.
|
||||
|
||||
---
|
||||
|
||||
## 8. Progress tracker
|
||||
|
||||
| Repo | Profile | Migrated branch | Secrets set | Actions on | CI green | Release path OK | GitLab mirror | Cron slots (UTC) |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| `.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).
|
||||
|
||||
---
|
||||
|
||||
## 9. GitLab mirror & outside contributions (maintainer)
|
||||
|
||||
**Setup / new repo:** `.\setup-mirrors.ps1 -GitLabNamespace poli0981 -DryRun`, then without `-DryRun` (or `-Only <repo>`). Revoke the short-lived `api` token afterwards.
|
||||
|
||||
**Token rotation:** the `write_repository` token stored in Gitea expires after at most 365 days. Before that date: create a new token, run the script with `-Rotate`, then revoke the old token.
|
||||
|
||||
**Notifications:** GitLab → Preferences → Notifications: set the global level (or each project) to **Watch**, otherwise new issues and MRs from strangers do not send e-mail.
|
||||
|
||||
**Applying a GitLab merge request** (on the PC, in the Gitea clone):
|
||||
```bash
|
||||
git fetch https://gitlab.com/poli0981/<repo>.git merge-requests/<iid>/head:mr-<iid>
|
||||
git log --oneline main..mr-<iid> # review; run tests / CI on a Gitea branch first if needed
|
||||
git switch main
|
||||
git merge --no-ff mr-<iid> # keeps the contributor's commit SHAs
|
||||
git push origin main # Gitea pushes to GitLab; the MR normally shows as merged
|
||||
```
|
||||
If the commits were rebased or squashed (new SHAs), close the MR on GitLab with a link to the commit on Gitea.
|
||||
|
||||
**Patches by e-mail:** save the mails as `.patch`/`.mbox`, then `git am --3way <file>` on a branch, review, merge, push to Gitea.
|
||||
|
||||
**Security reports:** handled only by e-mail (`security@`). If one arrives as a public GitLab issue, make the issue confidential on GitLab and continue by e-mail.
|
||||
@@ -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\<repo>.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/<file>/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:[<label ids>]}` |
|
||||
| `gh issue edit --body-file` / `gh issue close` | `PATCH /repos/{owner}/{repo}/issues/{n}` `{body}` / `{state:"closed"}` |
|
||||
| `gh issue comment` / `gh pr comment` | `POST /repos/{owner}/{repo}/issues/{n}/comments` `{body}` |
|
||||
| find an open issue by title | `GET /repos/{owner}/{repo}/issues?state=open&type=issues&q=<words>` |
|
||||
| `gh pr create` | `POST /repos/{owner}/{repo}/pulls` `{base, head, title, body}` |
|
||||
| `gh pr merge --auto --squash` | `POST /repos/{owner}/{repo}/pulls/{n}/merge` `{do:"squash", merge_when_checks_succeed:true}` |
|
||||
| `gh workflow run <file> --ref <b>` | `POST /repos/{owner}/{repo}/actions/workflows/<file>/dispatches` `{ref}` (job token with `actions: write`) |
|
||||
| `gh api …/pulls/{n}/files` | `GET /repos/{owner}/{repo}/pulls/{n}/files` |
|
||||
| `gh api …/git/tags/{sha}` (`verification`) | `GET /repos/{owner}/{repo}/git/tags/{sha}` (has `verification`; **VERIFY** that Gitea knows the signing key) |
|
||||
| `gh release create/edit/upload` | `https://gitea.com/actions/gitea-release-action` (notes + links, no binaries: runbook §1), or `POST /repos/{owner}/{repo}/releases` |
|
||||
|
||||
Events caused by the job token start no workflow (Gitea skips the Actions user, as GitHub skips `GITHUB_TOKEN`): a release published by CI does not fire `release: published`, and a PR opened by CI runs no checks (D5).
|
||||
|
||||
## Shared replacements
|
||||
|
||||
- **CodeQL** (local, or a caller of `reusable-codeql.yml@main`, which the ops repo no longer has) → a caller of the ops `security.yml` (gitleaks, Opengrep, osv-scanner, cargo-deny, NuGetAudit).
|
||||
- **`JetBrains/qodana-action`** → a caller of the ops `reusable-qodana.yml` (Qodana CLI, native mode, report as an artifact). The SARIF upload to GitHub code scanning goes away.
|
||||
- **`actions/upload-artifact` / `download-artifact`** → `christopherhx/gitea-upload-artifact` / `gitea-download-artifact` at the SHAs the ops repo pins.
|
||||
- **Discord notifications** → callers of the ops `notify-*` / `announce-release` workflows, with `ops_ref` set to the same SHA as `uses:`. Delete vendored copies of `discord_notify.py` (they call `api.github.com`).
|
||||
- **Unpinned actions** (`@v7`) → pin the 40-char SHA with a version comment (runbook rule 6).
|
||||
@@ -0,0 +1,30 @@
|
||||
# bookmarkmagic — migration guide
|
||||
|
||||
> Written 2026-11-23 against `main` @ `acad57a`. Profile: browser extension (WXT + Svelte 5) for Chrome, Edge and Firefox, store submissions from CI (runbook §5.4). Its docs/12 describes the CI. Shared decisions D1–D7: [README](README.md).
|
||||
|
||||
## Before the session: decide
|
||||
|
||||
- D1 (SonarCloud), D2 (triage), D6 (the checks branch protection reads: "Quality gates", "Build + package / build").
|
||||
- **BM1 — where users download the zip.** Today: the GitHub release (zip + `SHA256SUMS.txt`). Default: R2 under `releases.poli0981.dev/bookmarkmagic/<version>/` plus a Gitea release with links; the stores stay the main channel.
|
||||
|
||||
## Workflows (`.github/workflows` → `.gitea/workflows`)
|
||||
|
||||
| File | Today | Do |
|
||||
|---|---|---|
|
||||
| `ci.yml` | caller of `poli0981/.github/.github/workflows/reusable-chrome-extension.yml@main` + local `quality` job; `actions/checkout@v7`, `setup-node@v7` unpinned | Caller → `poli0981/.github/.gitea/workflows/reusable-chrome-extension.yml@<ops-sha> # ops v2026.11.N`; pin the local job's actions |
|
||||
| `codeql.yml` | caller of `reusable-codeql.yml@main` (that path is gone: the ops repo's workflows now live in `.gitea/workflows`), cron `0 14 * * 1` | **Delete** → `security.yml` caller (`node: true`), cron **`59 14 * * 0`** |
|
||||
| `notify-ci-failure.yml` | caller of `notify-ci-failure.yml@main`, gated by variable `DISCORD_CI_NOTIFY` | Path `.gitea/workflows/…@<ops-sha>`, `with: { default_branch: main, ops_ref: <ops-sha> }`; keep the gate (the reusable requires the webhook secret) |
|
||||
| `qodana.yml` | `qodana-action` + SARIF to code scanning (`GITHUB_TOKEN`), cron `0 15 * * 1` | Caller of `reusable-qodana.yml`: `package-manager` as the repo uses, `prepare-command` for WXT's generated types (e.g. `npx wxt prepare`), cron **`41 15 * * 1`**. The SARIF upload goes |
|
||||
| `release.yml` | build + gates + zip + `SHA256SUMS.txt`; `gh release create/upload` with `secrets.GITHUB_TOKEN`; store jobs (CWS, Edge, AMO) re-download `SHA256SUMS.txt` from the GitHub release; announce via `announce-release.yml@main` | Keep the job split and the store jobs. Hand the zip and `SHA256SUMS.txt` to the store jobs as a Gitea artifact instead of `gh release download`. Publish them to R2 with `publish-r2.yml` (`app: bookmarkmagic`, versioned dir `<version>/`, no feed) and make the Gitea release with `gitea-release-action` (links only). Announce: caller path + SHA, map `RELEASES_WEBHOOK`/`REPO_WEBHOOK` to the reusable's `DISCORD_RELEASES_WEBHOOK`/`DISCORD_REPO_WEBHOOK`. Store and R2 secrets stay in tag-push jobs only (rule 10) |
|
||||
| `sonarcloud.yml` | SonarCloud, upstream artifact actions | **Delete** (D1) |
|
||||
| `triage.yml` | `issues` + `pull_request_target`, `gh` + `scripts/triage.mjs` | **Delete** with the script and its tests (D2) |
|
||||
|
||||
`.github/dependabot.yml` → delete; add `renovate.json`. `.github/FUNDING.yml` is GitHub-only: keep it inert or remove it with its README mention.
|
||||
|
||||
## Links and docs
|
||||
|
||||
`README.md` (12), `package.json` (3: `repository`, `bugs`, `homepage`), `.github/ISSUE_TEMPLATE/` (`feature_request.yml` 3, `config.yml` 2, `accessibility.yml`, `bug_report.yml`), `ACCESSIBILITY.md` (2), `CONTRIBUTING.md` (2), and the **store listings** `store/listing.{en,ja,ro,vi,zh_CN}.md` (support/source links: issues → GitLab, source → Gitea, kept in parity across the five languages; they ship with the next store update). The manifest's `homepage_url` (WXT config). `CHANGELOG.md` keeps its history. `SECURITY.md`: GitHub advisories → `security@poli0981.dev` (already documented). Add GitLab issue/MR templates (runbook §3.4).
|
||||
|
||||
## Secrets and variables
|
||||
|
||||
Keep (repo): `CHROME_EXTENSION_ID`, `CHROME_PUBLISHER_ID`, `CHROME_SERVICE_ACCOUNT_CLIENT_EMAIL`, `CHROME_SERVICE_ACCOUNT_PRIVATE_KEY`, `EDGE_API_KEY`, `EDGE_CLIENT_ID`, `EDGE_PRODUCT_ID`, `FIREFOX_EXTENSION_ID`, `FIREFOX_JWT_ISSUER`, `FIREFOX_JWT_SECRET`, `QODANA_TOKEN`, `DISCORD_CI_WEBHOOK`, `RELEASES_WEBHOOK`, `REPO_WEBHOOK`. Variables to recreate on Gitea: `AMO_AUTOPUBLISH`, `CWS_AUTOPUBLISH`, `EDGE_AUTOPUBLISH`, `DISCORD_ANNOUNCE`, `DISCORD_CI_NOTIFY`. Create (user level): R2 keys + `R2_ACCOUNT_ID`. Drop: `SONAR_TOKEN`, the explicit `GITHUB_TOKEN` use.
|
||||
@@ -0,0 +1,38 @@
|
||||
# frameledger — migration guide
|
||||
|
||||
> Written 2026-11-23 against `main` @ `7a77b73`. Profile: .NET (WPF, SDK pinned by `global.json`, .NET 11 band) + native C++ (MSVC, CMake, Vulkan SDK), Velopack (runbook §5.1). CI is repo-local by design: it runs `./build.ps1 check`, the same script as a local build (docs/12_BUILD.md, docs/13_CI_CD.md). Shared decisions D1–D7: [README](README.md).
|
||||
|
||||
## Before the session: decide
|
||||
|
||||
- **FL1 — SAST for the C++ layer.** CodeQL analysed C# **and** C++. Opengrep's community rules have no C++ set (its `c/` rules target C files only), so `security.yml` covers C# and the workflows, not the native layer. Options: accept it (Qodana native already reads the C++ solution through `qodana-native.yaml`), or add MSVC `/analyze` or clang-tidy to `build.ps1 check`.
|
||||
- **FL2 — the wiki.** `wiki.yml` publishes `wiki/` + `guide/` to the GitHub Wiki after each release. Gitea has a wiki too (a `<repo>.wiki.git` repository). Port it (push with the job token and `permissions: wiki: write`, **VERIFY** that the job token may push the wiki), or drop it: the pages are in the repo.
|
||||
- D1 (the Sonar step in `ci.yml`), D6 (required checks).
|
||||
|
||||
## Workflows (`.github/workflows` → `.gitea/workflows`)
|
||||
|
||||
| File | Today | Do |
|
||||
|---|---|---|
|
||||
| `ci.yml` | `windows-latest`, `./build.ps1 check`; Sonar (`SONAR_TOKEN`); `gh api repos/…/pulls/$PR_NUMBER/files` for the changed files; upstream artifact actions; 9 unpinned `@vN` | Move. Pin every action (runbook rule 6). Gitea artifact actions. Replace `gh api …/pulls/{n}/files` with `curl` to `${{ github.api_url }}/repos/${{ github.repository }}/pulls/{n}/files` and the job token (README "gh → Gitea API"). Remove the Sonar part (D1) |
|
||||
| `codeql.yml` | CodeQL C# + C++ + actions, cron `27 4 * * 1` | **Delete** → `security.yml` caller: `dotnet: true`, `dotnet-runs-on: windows-latest`, `dotnet-version` matching global.json's band, cron **`41 14 * * 5`**. FL1 for C++ |
|
||||
| `qodana.yml` | `qodana-action`, two jobs: managed (`qodana.yaml`, `QODANA_TOKEN`) and native (`qodana-native.yaml`, `QODANA_TOKEN_NATIVE`, CMake generates the solution first) | Keep the file local (each job has build pre-steps), and swap only the action step for the Qodana CLI, as `reusable-qodana.yml`'s Windows steps do (pinned CLI 2026.3.1 + SHA-256, `qodana scan --within-docker false [--config qodana-native.yaml]`, report artifact). Drop the `checks` permission and the SARIF upload |
|
||||
| `release.yml` | tag `v*`: VERSION/CHANGELOG gates, publish, `vpk download github` → `vpk pack` → upload to GitHub Releases, checksums | Keep the gates. Velopack to R2 (runbook §5.1): `vpk download s3` / `vpk upload s3` with `VPK_BUCKET=poli0981-releases`, `VPK_PREFIX=frameledger/`, `VPK_ENDPOINT=https://${{ vars.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com`, keys from the R2 secrets as env only. Keep the repo's channel names. Checksums to R2 next to the packages; Gitea release (notes from CHANGELOG via `body_path`, links only) with `gitea-release-action`. No `GH_TOKEN` |
|
||||
| `rules-publish.yml` | path-filtered gate for the detection rules | Move; pin `actions/checkout` |
|
||||
| `wiki.yml` | `workflow_run` on Release → GitHub Wiki | FL2. `workflow_run` works on Gitea; the payload's `head_branch` is **empty for tag runs** (README, ops notify fix): take the tag from `github.event.workflow_run.path` |
|
||||
|
||||
`.github/dependabot.yml` → delete; add `renovate.json`.
|
||||
|
||||
## Code and tests
|
||||
|
||||
- `src/FrameLedger.App/Update/VelopackUpdateClient.cs`: `GithubSource` → HTTP source `https://releases.poli0981.dev/frameledger` (runbook §5.1); remove any GitHub token logic. Update `docs/11_UPDATER.md`.
|
||||
- `Directory.Build.props`: `RepositoryUrl` / `PackageProjectUrl` → Gitea.
|
||||
- Tests pin the GitHub URLs: `MarkdownLinksTests.cs` (4), `AccessibilityDocumentTests.cs`, `BugReportFlowTests.cs`, `DocumentWindowsTests.cs` (2 each). Change them with the links: source → Gitea, bug reports → `gitlab.com/poli0981/frameledger/-/issues`. Keep `.resx` EN/VI/JA in parity if a string changes.
|
||||
- Links: `README.md` (3), `wiki/Home.md` (2), `.github/ISSUE_TEMPLATE/accessibility.yml` + `config.yml`, `ACCESSIBILITY.md`, `FORKING.md`, `docs/10_LOGGING_AND_BUG_REPORTS.md`. The `githubusercontent` hits in `legal/licenses/` and `tools/license-overrides/` are third-party licence sources: leave them.
|
||||
- `SECURITY.md` points at GitHub advisories → e-mail. The repo documents `contact@poli0981.dev`; keep it if that is the security contact, otherwise `security@` (runbook §1 "Contact").
|
||||
|
||||
## Secrets
|
||||
|
||||
Keep `QODANA_TOKEN`, `QODANA_TOKEN_NATIVE`. Create (user level): R2 keys + `R2_ACCOUNT_ID`. Drop `SONAR_TOKEN`; no `GH_TOKEN`.
|
||||
|
||||
## Hand-off extras
|
||||
|
||||
Installed copies update from GitHub Releases and cannot be redirected (runbook §7 item 5): say which versions are affected. Branch protection (D6). Host mode: the release job runs MSVC/CMake on the PC; it installs nothing system-wide (the SDK goes to the runner tool cache as in the ops reusables).
|
||||
@@ -0,0 +1,38 @@
|
||||
# OmniDeck — migration guide
|
||||
|
||||
> Written 2026-11-23 against `main` @ `90f667e`. Profile: .NET 10 WPF (`net10.0-windows`, `.slnx`), Velopack, releases from GPG-signed annotated tags only (no `workflow_dispatch`, RELEASING.md). Every CI job is a required check on `main` (GitHub ruleset). Shared decisions D1–D7: [README](README.md).
|
||||
|
||||
## Before the session: decide
|
||||
|
||||
- **OD1 — the catalog source.** `src/OmniDeck.Web/Catalog/OdCatalogService.cs` reads a file from `raw.githubusercontent.com`. That URL is gone with the account. Serve it from R2 (`releases.poli0981.dev/omnideck/…`, a `-latest.` or `.json` name so the cache is bypassed), or from Gitea raw (`https://git.poli0981.dev/poli0981/OmniDeck/raw/branch/main/<path>`). R2 keeps the app off the forge.
|
||||
- **OD2 — licence gate.** `dependency-review.yml` failed PRs that add GPL-incompatible licences. Nothing on Gitea does that (D7). Options: a local check in CI over `dotnet list package --include-transitive` + a licence allow-list, or accept the gap.
|
||||
- **OD3 — signed-tag check.** `release.yml` asks the GitHub API whether the tag's signature is verified. Gitea answers the same question (`GET /repos/{owner}/{repo}/git/tags/{sha}` → `verification`) only if your GPG key is on the Gitea account. Add the key, or verify with `git tag -v` in the job against a pinned public key.
|
||||
- D1, D6, D7 (attestations, Scorecard, dependency review, GitHub SBOM).
|
||||
|
||||
## Workflows (`.github/workflows` → `.gitea/workflows`)
|
||||
|
||||
| File | Today | Do |
|
||||
|---|---|---|
|
||||
| `ci.yml` | build/test/package/lint on Ubuntu + Windows; upstream `upload-artifact` | Move; Gitea artifact action. Jobs keep their names (they become branch-protection checks, D6) |
|
||||
| `codeql.yml` | CodeQL C# (manual build on Windows) + actions, cron `23 4 * * 1` | **Delete** → `security.yml` caller: `dotnet: true`, `dotnet-runs-on: windows-latest`, `dotnet-solution: <name>.slnx`, cron **`23 14 * * 6`** |
|
||||
| `dependency-review.yml` | vulnerable deps + licence gate on PRs | **Delete** (D7); NuGetAudit + osv-scanner in `security.yml` cover vulnerabilities; OD2 for licences |
|
||||
| `scorecard.yml` | OpenSSF Scorecard, SARIF to code scanning, `id-token` | **Delete** (D7) |
|
||||
| `sonarcloud.yml` | SonarQube Cloud | **Delete** (D1) |
|
||||
| `notify.yml` | vendored `.github/scripts/discord_notify.py` (calls `api.github.com`); CI failures + manual release announcements | Callers of ops `notify-ci-failure.yml` (watch `CI`), `notify-release-pipeline.yml` (watch `Release`: the CI notifier skips names with "elease" on purpose) and `announce-release.yml` (`release: published` + `workflow_dispatch`), each with `ops_ref`. Delete the vendored script |
|
||||
| `release.yml` | signed-tag check via `gh api`; `vpk download/upload github`; SBOM from `dependency-graph/sbom`; checksums; `gh release edit`; attestations; Discord announce | Keep the tag rules. OD3 for the check. Velopack to R2 (`vpk download s3` / `vpk upload s3`, `VPK_PREFIX=omnideck/`, runbook §5.1). SBOM: generate it in the build (CycloneDX for .NET) and put it, with SHA256SUMS, under `omnideck/<version>/` via `publish-r2.yml` or `rclone` (versioned names). Gitea release (notes from CHANGELOG, links only, `prerelease` for < 1.0.0 as today) via `gitea-release-action`. **Drop** attestations and `id-token`. A release created by the job token fires no `release` event (README), so keep announcing from this workflow: add a job that calls `announce-release.yml` with `tag_override: ${{ github.ref_name }}` |
|
||||
|
||||
`.github/dependabot.yml` → delete; add `renovate.json`. `.github/CODEOWNERS` → `.gitea/CODEOWNERS`: Gitea reads only `CODEOWNERS`, `docs/CODEOWNERS` and `.gitea/CODEOWNERS`, and treats a pattern without `*` as a regular expression.
|
||||
|
||||
## Code
|
||||
|
||||
- `src/OmniDeck.App/Updates/OdVelopackUpdateService.cs`: `GithubSource` → `https://releases.poli0981.dev/omnideck` (HTTP source), no GitHub token.
|
||||
- `OdCatalogService.cs`: OD1.
|
||||
- `Directory.Build.props` (`RepositoryUrl`), `README.md` (6), `CONTRIBUTING.md` (2), `.github/ISSUE_TEMPLATE/config.yml` (2), `SECURITY.md` (GitHub advisories → `security@poli0981.dev`, already documented). `docs/spikes/*` and `CHANGELOG.md` mention GitHub as history: leave them.
|
||||
|
||||
## Secrets
|
||||
|
||||
Keep `DISCORD_CI_WEBHOOK`, `DISCORD_RELEASE_WEBHOOK` (the ops `announce-release.yml` expects `DISCORD_RELEASES_WEBHOOK` / `DISCORD_REPO_WEBHOOK`: map the name in the caller). Create (user level): R2 keys + `R2_ACCOUNT_ID`; `DISCORD_RELEASE_PIPELINE_WEBHOOK` (or map an existing webhook in the caller). Drop `SONAR_TOKEN`; no `GH_TOKEN`.
|
||||
|
||||
## Hand-off extras
|
||||
|
||||
Installs that update from GitHub Releases cannot be redirected (runbook §7 item 5). Recreate the `main` ruleset as Gitea branch protection with the CI job names (D6).
|
||||
@@ -0,0 +1,40 @@
|
||||
# pipdock — migration guide
|
||||
|
||||
> Written 2026-11-23 against `main` @ `fdc51a8`. Profile: Tauri 2 (no self-update) + Rust workspace + React/Vite (runbook §5.2, §5.5). Old remote `github` = `github.com/poli0981org/pipdock` (the org it moved to on 2026-11-21); Gitea: `poli0981/pipdock`. Shared decisions D1–D7: [README](README.md).
|
||||
|
||||
## Before the session: decide
|
||||
|
||||
- **D4 (main one here).** Since the move to `poli0981org`, every workflow is project-local on purpose ("a project in the organization no longer runs a workflow another account can change"; RELEASE-CI.md §1), and the notifier is vendored. On Gitea the repo and the ops repo have the same owner, and callers pin a commit SHA. Default: call the ops repo for **security** and **notifications**, keep everything else local. If you keep the policy instead, the guide's "ops caller" rows become "port in place".
|
||||
- D1 (Sonar), D2 (triage), D7 (attestations).
|
||||
- Qodana Rust: `qodana-rust` has no native mode (the repo's own qodana.yml says so). On Gitea it needs Docker: run it on `windows-latest` with Docker Desktop on the PC (`within-docker: true`, **VERIFY**), or drop the Rust project (clippy + cargo-deny stay).
|
||||
|
||||
## Workflows (`.github/workflows` → `.gitea/workflows`)
|
||||
|
||||
| File | Today | Do |
|
||||
|---|---|---|
|
||||
| `ci-node.yml` | lint/typecheck/test/build, `npm licences` job runs the triage script's tests | Move. Drop the triage tests with D2 |
|
||||
| `ci-rust.yml` | Linux + Windows (PEP 514 registry needs Windows) | Move. Windows job = host mode on the PC: check it creates no system-wide state |
|
||||
| `ci-integration.yml` | Windows, real pip/uv in disposable venvs; cron `17 3 * * *` + `17 4 * * 1`; upstream `upload-artifact` | Move; Gitea artifact action; crons → **`47 13 * * *`** and **`53 14 * * 2`**. Host mode: venvs go under the job's temp dir only |
|
||||
| `codeql.yml` | CodeQL Rust + actions + JS/TS | **Delete** → `security.yml` caller (`rust: true`, `node: true`, cron **`19 14 * * 4`**) |
|
||||
| `security-scan.yml` | daily `cargo audit` + `npm audit` of `main`, cron `41 5 * * *` | Keep (cheap, the repo's own gate) or drop in favour of `security.yml`'s osv-scanner + cargo-deny. If kept: cron → **`23 13 * * *`** |
|
||||
| `qodana.yml` | two jobs (Rust in Docker, TS native) via `qodana-action`, SARIF → code scanning | Two callers of `reusable-qodana.yml`: TS (`config: qodana-js.yaml`, `package-manager: npm`, token `QODANA_TOKEN_TS_JS`, `artifact-name: qodana-report-js`) and Rust (`config: qodana-rust.yaml`, `runs-on: windows-latest`, `within-docker: true`, token `QODANA_TOKEN_RUST`, `artifact-name: qodana-report-rust`). Delete the committed `.qodana/rust.sarif.json` if it is only a code-scanning upload |
|
||||
| `release.yml` | tag → NSIS .exe + .msi, SHA256SUMS.txt, attest, **draft** GitHub release (`softprops`) | Build on `windows-latest`, Gitea artifact actions; **drop attestation** (D7); publish with the ops `publish-r2.yml` (`app: pipdock`, `versioned-dir` holding `<version>/…` + `SHA256SUMS.txt`, no `feed-files`: PipDock does not update itself); draft **Gitea release** via `gitea-release-action` (`draft: true`, body = links to `https://releases.poli0981.dev/pipdock/<version>/…`). R2 secrets only in the tag job (rule 10) |
|
||||
| `notify.yml` | vendored `discord_notify.py` (calls `api.github.com`), `workflow_run` + `release` | D4 default: callers of ops `notify-ci-failure.yml` (watch `CI / Node`, `CI / Rust`, `CI / Integration`, `Security scan`), `notify-release-pipeline.yml` (watch `Release`; the CI notifier skips names with "elease") and `announce-release.yml`, each with `ops_ref`; delete `.github/scripts/discord_notify.py` |
|
||||
| `sonar.yml` | SonarQube Cloud | **Delete** (D1) |
|
||||
| `triage.yml` | `pull_request_target` + `github-script` + `.github/scripts/triage.cjs` | **Delete** with its script and tests (D2); keep the maintenance-mode text in CONTRIBUTING |
|
||||
|
||||
`.github/dependabot.yml` → delete; add `renovate.json` (runbook §3.5).
|
||||
|
||||
## Links and docs (tracked files that still say GitHub)
|
||||
|
||||
`README.md` (14), `.github/ISSUE_TEMPLATE/config.yml` (3), `CONTRIBUTING.md` (3), `package.json` (3: `repository`, `bugs`, `homepage`), `.github/SECURITY.md` (2), `ACCESSIBILITY.md` (2), `docs/AI-DISCLOSURE.md` (2), `docs/ROADMAP.md` (2), `Cargo.toml` (`repository`), `crates/pipdock-core/src/report.rs` (an in-app link: bug reports → GitLab issues). Leave `changelog/1.x.md` history alone. Update RELEASE-CI.md and CLAUDE.md ("Forge & CI").
|
||||
|
||||
`SECURITY.md` is only in `.github/`, where GitHub looked for it. Move it to the repo root, rewritten for e-mail-only reports (runbook §3.4).
|
||||
|
||||
## Secrets
|
||||
|
||||
Keep: `QODANA_TOKEN_RUST`, `QODANA_TOKEN_TS_JS`, `DISCORD_CI_WEBHOOK`, `DISCORD_RELEASES_WEBHOOK`, `DISCORD_REPO_WEBHOOK`. Create (user level, once): `R2_RELEASES_ACCESS_KEY_ID`, `R2_RELEASES_SECRET_ACCESS_KEY`, variable `R2_ACCOUNT_ID`; `DISCORD_RELEASE_PIPELINE_WEBHOOK` for the release notifier (or map an existing webhook to that name in the caller). Drop: `SONAR_TOKEN`.
|
||||
|
||||
## Hand-off extras
|
||||
|
||||
Existing installs do not update themselves, so nothing to redirect; README's download links move to `releases.poli0981.dev/pipdock/<version>/`. Branch protection for the old required checks (D6).
|
||||
@@ -0,0 +1,36 @@
|
||||
# poli0981-dev — migration guide
|
||||
|
||||
> Written 2026-11-23 against `main` @ `2ef3045`. Profile: web (Astro, Cloudflare Workers) with an admin (admin.poli0981.dev), a widgets Worker and the `src/content` submodule (`poli0981/content`). Docs live in `poli0981.dev-docs/`; there is no CLAUDE.md. Shared decisions D1–D7: [README](README.md).
|
||||
|
||||
This repo talks to GitHub from **its own code**, not only from CI. That part is product work: plan it before the session.
|
||||
|
||||
## Before the session: decide
|
||||
|
||||
- **PD1 — the admin's "Publish".** The admin dispatches `content-bump.yml` and writes `poli0981/content` through the GitHub API (`src/lib/admin/github.ts`). Port it to the Gitea API with a Gitea token scoped to the two repos (Cloudflare secret of the admin Worker, not an Actions secret), or keep publishing by hand.
|
||||
- **PD2 — the public bug report.** `src/pages/api/report.ts` opens an issue per report with `POST api.github.com/repos/<REPORT_REPO>/issues` and a token. Issues now go to the GitLab mirror (runbook §1): the GitLab issues API with a project access token, or e-mail.
|
||||
- **PD3 — the widgets feed.** `workers/widgets/src/feeds.ts` reads `api.github.com/users/poli0981/events/public` (with `GITHUB_TOKEN`), which ended with the account. Gitea has `GET /api/v1/users/poli0981/activities/feeds`, or drop the widget.
|
||||
- D3 (Workers Builds deploys `main` from GitHub today), D5 (content-bump's PR + auto-merge), D1, D2, D6 (`build` is the required check).
|
||||
|
||||
## Workflows (`.github/workflows` → `.gitea/workflows`)
|
||||
|
||||
| File | Today | Do |
|
||||
|---|---|---|
|
||||
| `ci.yml` | `build` (required), Sonar, upstream artifact actions, wrangler | Move; Gitea artifact actions; remove Sonar (D1); deploy job on `main` with `wrangler deploy` (D3) |
|
||||
| `content-bump.yml` | dispatched by the admin: bump `src/content`, push `content/bump`, `gh pr create`, `gh pr merge --auto --squash` (or comment and wait when MDX changed), `gh workflow run ci.yml` | Gitea API (README table): create PR, merge with `{do:"squash", merge_when_checks_succeed:true}`, comment, dispatch `ci.yml`. `permissions: contents: write, pull-requests: write, actions: write`. PD1 for the caller |
|
||||
| `lighthouse.yml` | advisory perf budget on PRs | Move |
|
||||
| `osv-scanner.yml` | Google's osv-scanner reusable, SARIF, cron `17 3 * * 1` | **Delete** → `security.yml` caller (`node: true`), cron **`13 14 * * 3`** |
|
||||
| `qodana.yml` | `qodana-action`, SARIF to code scanning | Caller of `reusable-qodana.yml` (`package-manager: npm`, `prepare-command: npx astro sync` if needed) |
|
||||
| `triage.yml` | `pull_request_target` + `scripts/triage.mjs` | **Delete** with the script (D2) |
|
||||
|
||||
`.github/dependabot.yml` → delete; add `renovate.json`.
|
||||
|
||||
## Code, submodule, links
|
||||
|
||||
- `.gitmodules`: `src/content` → `https://git.poli0981.dev/poli0981/content.git` (that repo must be on Gitea; there is a local `E:\content`).
|
||||
- `src/lib/admin/github.ts` (PD1), `src/pages/api/report.ts` (PD2), `workers/widgets/src/feeds.ts` (PD3), `src/components/admin/Dashboard.svelte` (link), and their tests: `tests/api-public.test.ts` (5), `tests/widgets-worker.test.ts` (2), `tests/support/github.ts`.
|
||||
- `README.md` (6), `CONTRIBUTING.md` (4), `.github/ISSUE_TEMPLATE/config.yml` (2), `.github/pull_request_template.md` (2), `ACCESSIBILITY.md` (2), `public/.well-known/security.txt`, `poli0981.dev-docs/02_ARCHITECTURE.md`, `06_SECURITY.md`, `11_WIDGETS_INTEGRATIONS.md`, `12_LEGAL/CONTENT_LICENSE.md`. `CHANGELOG.md` keeps its history.
|
||||
- Add a short "Forge & CI" section to the docs (runbook §3.4); a CLAUDE.md would be the place if you add one.
|
||||
|
||||
## Secrets
|
||||
|
||||
Keep `QODANA_TOKEN`. Create (user level): `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID` (D3). Drop `SONAR_TOKEN`. Outside Actions: the admin's Gitea token (PD1) and the report endpoint's GitLab token (PD2) as Worker secrets.
|
||||
@@ -0,0 +1,31 @@
|
||||
# softharbor — migration guide
|
||||
|
||||
> Written 2026-11-23 against `main` @ `289ab47`. Profile: web (Astro, Cloudflare Workers) with data bots that open issues and pull requests (runbook §5.3). Its docs/12 describes the CI; `ci.yml` is self-contained on purpose (the old reusable broke every run). Shared decisions D1–D7: [README](README.md).
|
||||
|
||||
## Before the session: decide
|
||||
|
||||
- **D3 — deploys.** Workers Builds deploys `main` from GitHub (CLAUDE.md, docs/00) and stopped with the account. Default: a deploy job with `wrangler deploy` from Gitea CI.
|
||||
- **D5 — bot PRs.** `quarantine.yml` and `vt-recheck.yml` push a branch, open or update ONE pull request and then start `ci.yml` and `codeql.yml` on it with `gh workflow run`, because a PR made by the job token runs no checks. The same holds on Gitea; dispatch keeps working through the Gitea API.
|
||||
- D1 (the `sonar` part of `ci.yml`), D6 (the `main` ruleset's required checks).
|
||||
|
||||
## Workflows (`.github/workflows` → `.gitea/workflows`)
|
||||
|
||||
| File | Today | Do |
|
||||
|---|---|---|
|
||||
| `ci.yml` | gates + build, Sonar (`SONAR_TOKEN`), upstream `upload-artifact`, job token use | Move; Gitea artifact action; remove Sonar (D1); add the deploy job on `main` pushes (D3), with Cloudflare secrets only in that job |
|
||||
| `codeql.yml` | caller of `reusable-codeql.yml@main` (that path is gone: the ops repo's workflows now live in `.gitea/workflows`), cron `31 3 * * 1` | **Delete** → `security.yml` caller (`node: true`), cron **`37 15 * * 2`**. Bots that dispatched `codeql.yml` dispatch the security workflow instead |
|
||||
| `link-check.yml` | weekly sweep, ONE tracking issue refreshed or closed with `gh issue …`, cron `43 4 * * 1` | Cron → **`43 14 * * 1`**. `gh issue edit/comment/create/close` → Gitea API (README table), `permissions: issues: write` |
|
||||
| `notify.yml` | caller of `announce-release.yml@main` | `.gitea/workflows/announce-release.yml@<ops-sha>` with `ops_ref`, explicit secrets |
|
||||
| `qodana.yml` | `qodana-action`, SARIF to code scanning | Caller of `reusable-qodana.yml` (`package-manager` as in the repo, `prepare-command: <pm> exec astro sync` if `qodana.yaml` needs Astro's types); no schedule today, keep it so |
|
||||
| `quarantine.yml` | on data pushes + nightly `17 2 * * *`; opens a PR, `gh workflow run ci.yml / codeql.yml`, `gh issue create` | Cron → **`17 13 * * *`**. Branch + PR + dispatch + issue through the Gitea API (README table), `permissions: contents: write, pull-requests: write, issues: write, actions: write` on that job only |
|
||||
| `vt-recheck.yml` | daily `41 0 * * *`, `VT_API_KEY`, ONE PR `vt/recheck`, `gh workflow run`, `gh issue create`, upstream `upload-artifact` | Cron → **`59 13 * * *`**; same Gitea API port as quarantine; Gitea artifact action. Check VirusTotal's daily quota still fits one run at that hour |
|
||||
|
||||
`.github/dependabot.yml` → delete; add `renovate.json`. `.github/CODEOWNERS` → `.gitea/CODEOWNERS` (Gitea reads only the root, `docs/` and `.gitea/`; a pattern without `*` is a regular expression).
|
||||
|
||||
## Links and docs
|
||||
|
||||
`README.md` (13), `.github/ISSUE_TEMPLATE/` (`config.yml` 3, `listing_change.yml`, `accessibility.yml`), `ACCESSIBILITY.md` (2), `docs/09_SECURITY_PRIVACY.md` (2), **`public/.well-known/security.txt`** (2: keep `Contact: mailto:security@…`, policy URL → Gitea), the in-app links in `src/components/legal/Accessibility.astro` and the bug-report island with its test `ShBugReport.test.ts` (issues → GitLab), `LICENSE-DATA.md`, `CONTRIBUTING.md`, `docs/03_DATA_FLOW.md`, `docs/05_ALGORITHMS.md`, CLAUDE.md (deploy path). The `github.io` hits in `src/data/apps/*.json` are third-party apps' homepages: data, leave them. `CHANGELOG.md` keeps its history. `SECURITY.md`: GitHub advisories → e-mail (`security@` is already documented).
|
||||
|
||||
## Secrets
|
||||
|
||||
Keep: `VT_API_KEY`, `QODANA_TOKEN`, `DISCORD_RELEASES_WEBHOOK`. Create (user level): `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID` (D3). Drop: `SONAR_TOKEN`.
|
||||
@@ -0,0 +1,21 @@
|
||||
# ticktune — finish the pilot
|
||||
|
||||
> Written 2026-11-23 against `chore/gitea-migration` @ `f64f8d2` (20 commits ahead of `main`). Profile: web (Astro, Cloudflare Workers). See [README](README.md) for the shared decisions D1–D7.
|
||||
|
||||
The pilot did the migration (runbook §3.2–§3.5): workflows in `.gitea/workflows`, Renovate, the ops `security.yml` caller, the Qodana CLI, Gitea artifact actions, schedules in the window, Gitea + GitLab links, GitLab templates, docs and CLAUDE.md. The GitHub mentions left are deliberate history ("the project moved from GitHub…", the old `github.com/poli0981.gpg` keyring). What is left:
|
||||
|
||||
## Agent (on the same branch)
|
||||
|
||||
1. **D1 — SonarQube Cloud.** `ci.yml` still has the `sonar` job (`SonarSource/sonarqube-scan-action`, `SONAR_TOKEN`). If D1 is "remove": delete the job, `sonar-project.properties`, the coverage hand-off that only feeds it (keep the LCOV if another job reads it), and the Sonar text in `docs/14-CI-CD.md` and `qodana.yaml`'s comments. Say in docs/14 what covers it now (Qodana for the TypeScript, Opengrep via `security.yml`).
|
||||
2. **Ops pin.** `security.yml` calls the ops repo at `2a255e0` (`v2026.11.1`). `security.yml` itself did not change in the next ops release, so this is optional; bump it with the rest when the ops repo is tagged again.
|
||||
3. Optional, for one Qodana setup across repos: `qodana.yml` can become a caller of the ops `reusable-qodana.yml` (`package-manager: pnpm`, `node-version-file: .nvmrc`, `prepare-command: pnpm exec astro sync`, cron `13 15 * * 1`). The pilot's own file does the same thing; only switch if you want the shared one.
|
||||
|
||||
## Maintainer
|
||||
|
||||
1. Review and merge `chore/gitea-migration` (runbook §3.8).
|
||||
2. Secrets: `QODANA_TOKEN` (repo), `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` (user level). Delete `SONAR_TOKEN` after D1.
|
||||
3. Repo settings → enable Actions. Branch protection on `main` with the checks `ci` requires (D6).
|
||||
4. Cloudflare: disconnect Workers Builds from GitHub (docs/10-CLOUDFLARE-SETUP.md); `deploy.yml` deploys now (D3).
|
||||
5. `maintainer/gitea-repo-setup.ps1 -Only ticktune` (renovate-bot + labels), Qodana Cloud VCS URL, GitLab mirror (`setup-mirrors.ps1 -Only ticktune`).
|
||||
6. Watch the first runs and close the pilot's **VERIFY** items: artifact actions, Qodana CLI native mode, `deploy.yml` (tag keys, Gitea release), the three schedules (14:37 Mon, 15:13 Mon, 15:29 Wed).
|
||||
7. Tick ticktune in the runbook tracker (§8).
|
||||
@@ -0,0 +1,28 @@
|
||||
# tilepier — migration guide
|
||||
|
||||
> Written 2026-11-23 against `main` @ `d1c9973`. Profile: web (SvelteKit, Cloudflare Workers) with Playwright e2e (runbook §5.3). Its doc 21 describes the CI. Shared decisions D1–D7: [README](README.md).
|
||||
|
||||
## Before the session: decide
|
||||
|
||||
- D3 (deploys: docs/internal/02-TECH-STACK.md names Workers Builds, which pulled from GitHub), D1 (the Sonar part of `ci.yml`), D6.
|
||||
- **TP1 — contacts.** The repo documents no `@poli0981.dev` address. Use the runbook defaults: `code@poli0981.dev`, `security@poli0981.dev`.
|
||||
|
||||
## Workflows (`.github/workflows` → `.gitea/workflows`)
|
||||
|
||||
| File | Today | Do |
|
||||
|---|---|---|
|
||||
| `ci.yml` | lint, dead code, tests, build, bundle budgets, secret gate, Sonar; upstream artifact actions; 6 unpinned `@vN` | Move; pin; Gitea artifact actions; remove Sonar (D1); deploy job on `main` with `wrangler deploy` (D3) |
|
||||
| `codeql.yml` | caller of `reusable-codeql.yml@main` (that path is gone: the ops repo's workflows now live in `.gitea/workflows`), cron `17 3 * * 1` | **Delete** → `security.yml` caller (`node: true`), cron **`7 15 * * 4`** |
|
||||
| `e2e.yml` | Playwright on PRs, pushes and daily `41 2 * * *`; upstream `upload-artifact`; 3 unpinned | Cron → **`29 14 * * *`**; pin; Gitea artifact action. Browsers install inside the Docker job (`npx playwright install --with-deps`) |
|
||||
| `notify.yml` | caller of `announce-release.yml@c3e118a…` (old `.github/workflows` path) | `.gitea/workflows/announce-release.yml@<ops-sha>` with `ops_ref`; explicit secrets |
|
||||
| `release.yml` | tag → **draft** GitHub release with the CHANGELOG section (`gh release create --draft --verify-tag`); 2 unpinned | `gitea-release-action` with `draft: true` and `body_path` (the CHANGELOG section); pin. The draft-then-publish-by-hand flow stays: a release published by you fires `release: published`, so `notify.yml` still announces it |
|
||||
|
||||
`.github/dependabot.yml` → delete; add `renovate.json`. No Qodana today; add a `reusable-qodana.yml` caller only if you want it (needs a Qodana Cloud project + `qodana.yaml`).
|
||||
|
||||
## Links and docs
|
||||
|
||||
In the app: `src/routes/about/+page.svelte` (3), `src/lib/core/bug-report.ts` (bug reports → GitLab issues), `static/.well-known/security.txt` (2) with its test `src/lib/security-txt.test.ts` (2), `src/lib/release.test.ts`, `e2e/legal-gate.e2e.ts`. Docs: `.github/ISSUE_TEMPLATE/config.yml` (2), `ACCESSIBILITY.md` (2), `CONTRIBUTING.md`, `SECURITY.md` (GitHub advisories → e-mail, TP1), `docs/internal/18-BUG-REPORTING.md`, `src/lib/widgets/quote/data/DATA-LICENSE.md`, CLAUDE.md. `CHANGELOG.md` keeps its history; the `github.io` hit in `licenses.generated.json` is third-party.
|
||||
|
||||
## Secrets
|
||||
|
||||
Keep `DISCORD_RELEASES_WEBHOOK`. Create (user level): `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID` (D3). Drop `SONAR_TOKEN`.
|
||||
@@ -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 }
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": ["local>poli0981/renovate-config"]
|
||||
}
|
||||
@@ -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()
|
||||
Reference in new issue
Block a user