Files
softharbor/.gitea/workflows/quarantine.yml
T
poli0981andClaude Opus 5.5 981e625ca1
CI / build (push) Successful in 3m19s
CI / gates (push) Successful in 1m5s
CI / record (push) Skipped
Reusable / Qodana / Qodana (push) Successful in 3m7s
Qodana / qodana (push) Successful in 3m7s
Reusable / Security / Secrets (gitleaks) (push) Successful in 10s
Reusable / Security / Rust (cargo-deny) (push) Skipped
Reusable / Security / .NET (NuGetAudit) (push) Skipped
Reusable / Security / SAST (Opengrep) (push) Successful in 24s
Reusable / Security / Dependencies (osv-scanner) (push) Successful in 17s
Security / security (push) Successful in 52s
CI / deploy (push) Successful in 1m9s
chore: move the repository to Gitea (D38) (#1)
- ci: move the workflows to Gitea Actions (D38)
- feat(site): source on Gitea, issues and bug reports on the GitLab mirror
- docs: where the project lives now — Gitea, the GitLab mirror, e-mail
- docs: the suite on Gitea — D38, CI/CD rewritten, every GitHub-era claim synced
- fix(ci): what the first Gitea runs found — Qodana and gitleaks
- fix(ci): .gitleaksignore describes the Sonar key instead of quoting it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 05:29:57 +00:00

90 lines
3.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# docs/12 §4 — enforces hard rule 5 mechanically.
#
# Runs on data pushes AND daily. The daily run re-checks main so a flagged
# entry that slipped past review is moved within a day — as a PR, not a push
# to main, so a human stays in the loop and branch protection still applies.
#
# On Gitea (D38):
# - The bot commits to `quarantine/auto` and pushes with the job token, then
# opens or updates the PR through the API (scripts/gitea.mjs). Its commits
# are unsigned — Gitea has no API that signs them — which is why branch
# protection does not require signed commits.
# - A push or PR the job token makes starts no workflow, so this job
# dispatches ci.yml and security.yml on the branch; ci.yml's `record` job
# turns the dispatched results into the statuses protection asks for.
# - `[quarantine] <slug>` issues are created only when none is open.
# - Step outputs never reach `run:` bodies through `${{ }}` (expression
# injection); they pass through `env:`, and gitea.mjs validates slugs.
# - Daily at 13:17 UTC (20:17 Vietnam), inside the runner's 13:00–16:00 UTC
# window, on a slot from the cron registry (poli0981/.github
# docs/migration/README.md).
name: quarantine
on:
push:
branches: [main]
paths: ['src/data/apps/**']
schedule:
- cron: '17 13 * * *'
workflow_dispatch:
permissions: {}
concurrency:
group: quarantine
cancel-in-progress: false
jobs:
sweep:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write # push quarantine/auto
pull-requests: write # open or update the PR
issues: write # one tracking issue per slug
actions: write # dispatch the checks onto the PR branch
steps:
# No persisted token while repository code (quarantine.mjs) runs; the
# push below authenticates on its own.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
- id: sweep
run: node scripts/quarantine.mjs
- name: Commit and push quarantine/auto
id: push
if: steps.sweep.outputs.moved != ''
env:
TOKEN: ${{ github.token }}
MOVED: ${{ steps.sweep.outputs.moved }}
run: |
set -euo pipefail
git config user.name 'SoftHarbor bot'
git config user.email 'actions@noreply.git.poli0981.dev'
git switch -c quarantine/auto
git add -A src/data/apps data/quarantine
git commit -q -m "data: quarantine ${MOVED}"
auth=$(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)
git -c "http.extraheader=AUTHORIZATION: basic ${auth}" push -q --force origin HEAD:refs/heads/quarantine/auto
printf 'Automated sweep: entries with `security.status: "flagged"` were\nmoved to `data/quarantine/`, which is outside the content glob, so\nthey stop rendering on the next build (docs/03 §5).\n\nNothing was deleted. Restoring is a `git mv` plus a status edit;\nthe reason and evidence live in the linked tracking issue.\n' > "$RUNNER_TEMP/pr-body.md"
echo "pushed=true" >> "$GITHUB_OUTPUT"
- name: Open the PR, run its checks, open the tracking issues
if: steps.push.outputs.pushed == 'true'
env:
GITEA_API: ${{ github.api_url }}
GITEA_REPO: ${{ github.repository }}
GITEA_TOKEN: ${{ github.token }}
MOVED: ${{ steps.sweep.outputs.moved }}
run: |
set -euo pipefail
node scripts/gitea.mjs pr quarantine/auto 'data: quarantine flagged entries' "$RUNNER_TEMP/pr-body.md" 'security,quarantine'
node scripts/gitea.mjs dispatch quarantine/auto ci.yml security.yml
# shellcheck disable=SC2086 # one argument per slug, on purpose
node scripts/gitea.mjs quarantine-issues $MOVED