Repository navigation
EN CI Automation
SniShaper uses a single build workflow (microsoft/winget-pkgs style) to drive all CI and PR bots. There is no workflow_run chain and no separate status-listener workflow.
| File | Responsibility |
|---|---|
.github/workflows/build.yml |
The only build workflow: direct pushes to main build, PRs get the CLA gate + full matrix + bot invocation |
.github/workflows/cla.yml |
Contributor agreement: sign guidance on PR open, /agree handling, reviewer assignment, CI restart |
.github/workflows/review-status.yml |
Human review state → labels (CHANGES_REQUESTED / APPROVED) |
.github/scripts/bots/common.sh |
Shared library: exemption list, gh_retry, sync_labels mutex groups, bot_comment anchor upsert |
.github/scripts/bots/ci-diagnose.sh |
CI failure diagnosis: downloads failed job logs and produces the five-element diagnosis |
.github/scripts/bots/labels.sh |
Label utilities |
.github/workflows/sync-forks.yml |
Weekly fork audit: opens upstream sync PRs for stale forks, skips forks with an existing linked PR |
Removed: pr-ci.yml, ci-status.yml (the old workflow_run chain, collapsed into build.yml).
| Event | Behavior |
|---|---|
push to main |
Build only (no bots) |
pull_request (opened / synchronize / reopened) |
CLA gate → build → bots |
workflow_dispatch (manual) |
Build only |
Key points:
-
Gate: the matrix only runs when the PR author is exempt or the PR carries the
cla-signedlabel; otherwise everything is skipped (neutral grey, not a red X). -
Concurrency: one build per PR (
build-<PR-number>group); a newer push cancels the stale matrix. -
tests job: reintroduced as the
test & vetjob (windows-latest, parallel to the build matrix):go vet -tags with_gvisor ./...+go test -tags with_gvisor ./...+ frontendnpm cithentsc --noEmit, wired into thecisummary job's needs; a failure turns thecicheck red.-raceand benchmarks still run locally by developers (docs/regression-tests_EN.md,docs/benchmarks.mdin the repository). -
Performance benchmarks: CI does not run benchmarks (shared runners are too noisy); developers validate performance changes on their own machines with benchstat — methodology in
docs/benchmarks_EN.mdin the repository. - ci job: a stable single-point summary check name for branch protection.
- bot-report job: after the build, the syntax-review-bot posts comments and writes labels.
- PR opened → the policy-bot posts a sign-guidance comment and the
cla-pendinglabel. - The PR author comments anything containing
agree→cla-signedlabel + confirmation reply + reviewer assignment (Snishaper, skipping the author) +reviewers-assignedlabel. - After signing, cla.yml reruns the PR's pull_request build run (not workflow_dispatch — dispatched checks never show up in the PR merge box; a rerun keeps the original event so the checks land in the merge box in place).
Nine labels; sync_labels enforces the mutex groups:
-
{cla-pending, cla-signed}mutually exclusive -
{ci-running, ci-failed, ci-passed}mutually exclusive -
{changes-requested, approved}mutually exclusive - A new CI round (adding
ci-running) also clearssyntax-review,changes-requestedandapproved
One round: push → ci-running → (success: ci-passed + syntax-review / failure: ci-failed + changes-requested) → stop.
On CI failure the syntax-review-bot posts a fresh diagnosis comment per round (anchor <!-- snishaper-bot:ci-diagnostic:<run_id> -->) with five elements per failed job: pipeline/platform/arch, error type, location, summary (raw log line), and job/run links. Diagnostic logs are downloaded with the workflow's GITHUB_TOKEN (actions: read) via curl; do not add an Accept: text/plain header (the logs endpoint returns 415).
Runs every Monday at 04:19 UTC and can also be triggered manually with workflow_dispatch; dry_run=true reports without creating PRs.
- Enumerates every fork via
GET /repos/SnishaperTeam/SniShaper/forks, skipping archived and disabled repositories. - Uses the compare API on
fork default branch...SnishaperTeam:main;ahead_by == 0means the fork is up to date. - For stale forks it opens a PR with
head=SnishaperTeam:mainandbase=<fork default branch>. A fork with an open PR whose head repository is the upstream repository (or whose head repository was deleted but whose label isSnishaperTeam:main) is skipped. - The PR head is the upstream default branch, so later upstream commits land in the same PR automatically; after a merge the fork is current and the next run opens nothing.
- Credential priority:
FORK_SYNC_TOKEN->RENOVATE_TOKEN->GITHUB_TOKEN. Cross-repository PR creation needs a classic PAT withpublic_repo; with onlyGITHUB_TOKENthe job is forced into report-only mode. - Forks whose history was rewritten (
No common ancestorfrom compare) and repositories that are no longer reachable are skipped. If a large compare response cannot be read, the job falls back to comparing branch SHAs, which still detects stale forks. - A single fork's API failure is a warning, not a job failure; the run ends with checked / created / skipped counts.
-
SnishaperTeam/SniShaper-Fastis not a GitHub fork (no fork relationship), so cross-repository PRs do not apply and it is out of scope.
- A push that carries workflow-file changes drops its own synchronize trigger — the new workflow definition only takes effect from the next push.
-
Dependabot-triggered runs receive no repo secrets —
pull_requestruns initiated by Dependabot get no secrets injected, so the syntax-bot App credentials are empty. Themark CI runningandbot-reportjobs therefore carrygithub.actor != 'dependabot[bot]'in theirif: Dependabot runs skip these two steps (the build matrix still runs), while human-triggered runs drive the state machine normally. -
Fork PRs'
pull_requestruns likewise receive no repo secrets —mark CI runningandbot-reporttherefore also carry a!github.event.pull_request.head.repo.forkguard: fork PRs skip those two jobs while build and test still run. -
The
secretscontext is not available in job-levelif(fails withUnrecognized named-value: 'secrets'; the workflow dies with zero jobs) — branching on secret presence must be done at step level, or via conditions likegithub.actor. - When a PR branch's merge-base is old, parallel cherry-picks against main dirty the merge ref and synchronize triggers get dropped. Always base test/feature branches on the latest main.
- Bot label writes never re-trigger the build (
labeledis not a trigger type), so there is no label → workflow → label feedback loop.
After publishing a release, the pipeline posts an in-app announcement to the notice service (/api/notices). The announcement bodies are AI-summarized: .github/scripts/generate-notice-summaries.ps1 uses an LLM (the OpenAI-compatible API behind LLM_API_KEY first, falling back to local Ollama) to summarize the Changes section of the release notes into three plain-text summaries — Chinese, English and Russian — written to notice-summaries.md (## zh / ## en / ## ru sections). The announcement step parses that file into body / body_en / body_ru. When the LLM is unavailable or its output is invalid, the step falls back to the raw Changes text; the announcement steps are continue-on-error and never block a release.
- Home
- 完整使用指南
- CLI 命令参考
- 核心模式详解
- 智能分流详解
- 规则自定义指南
- 界面配置指南
- 证书重新安装
- macOS 菜单栏应用
- Linux 软件包
- 代码结构
- Snishaper-Core 核心库
- CI 与 PR 自动化
- 便携式自动更新器
- 常见问题与排障
- Home
- Usage Guide
- CLI Reference
- Core Proxy Modes
- Auto Routing
- Custom Rules Guide
- GUI Configuration
- Certificate Installation
- macOS Menu Bar App
- Linux Packages
- Code Structure
- Snishaper-Core Library
- CI & PR Automation
- Portable Auto-Updater
- FAQ