Skip to content

feat(ci): introduce unified CI Required Gate workflow#6835

Open
Jacobinwwey wants to merge 8 commits intoAstrBotDevs:masterfrom
Jacobinwwey:feat/ci-required-gate
Open

feat(ci): introduce unified CI Required Gate workflow#6835
Jacobinwwey wants to merge 8 commits intoAstrBotDevs:masterfrom
Jacobinwwey:feat/ci-required-gate

Conversation

@Jacobinwwey
Copy link

@Jacobinwwey Jacobinwwey commented Mar 23, 2026

Motivation / 修改目的

当前 AstrBot 的 CI 检查分散在多个 workflow 中(format / unit tests / smoke / dashboard 等),但缺少一个统一、可直接被分支保护规则要求的“单一门禁信号”。

本 PR 的目标是引入 CI Required Gate

  • 把关键质量检查串成一条可聚合的主链路;
  • 在 PR 审核阶段提供稳定、可判定的通过/失败结论;
  • 兼顾效率(docs-only 快速路径)与稳定性(lint + tests + smoke + 条件 dashboard build)。

Overall Design / 整体思路

引入新的 workflow:

  • .github/workflows/ci-required-gate.yml

核心逻辑:

  1. 先做变更范围探测(changes job)。
  2. 根据变更范围决定执行路径(docs-only 快速通过 / 常规质量链路 / dashboard 条件构建)。
  3. 最终由 gate job 聚合所有上游结果,输出单一门禁状态 CI Required Gate

该设计与“分散检查 + 人工拼接判断”相比,降低 reviewer 决策成本,并且更适合后续分支规则直接配置 Required Check。


Modifications / 改动项详解

1) Workflow 触发策略

on:
  pull_request:
    branches: [master, dev]
  push:
    branches: [master]
  workflow_dispatch:

设置说明:

  • pull_request 覆盖 masterdev,解决不同目标分支下检查覆盖不一致的问题。
  • push master 让主分支持续接受同构验证(便于基线监控)。
  • workflow_dispatch 便于手动复验。

预期实践:

  • PR 合并门禁依赖 pull_request 结果。
  • push master 用于持续观测主分支健康度。

可行性:

  • 仅新增 workflow,不破坏现有发布/安全/文档流程。

2) 并发控制

concurrency:
  group: ci-required-gate-${{ github.event.pull_request.number || github.sha }}
  cancel-in-progress: true

设置说明:

  • 同一个 PR 的新提交会取消旧流水线。

预期实践:

  • reviewer 只需关注最新一次 CI 结果。
  • 节省 runner 时间,减少排队。

可行性:

  • 与现有 GitHub Actions 机制兼容,属于低风险优化。

3) changes 变更范围探测

changes job 通过 base..head diff 计算两个输出:

  • docs_only
  • dashboard_changed

并包含边界处理:

  • github.event.before 为空或全 0(首推/特殊场景)时回退到 HEAD^
  • 仍不可用时使用当前树文件列表兜底。

预期实践:

  • docs-only PR 不再跑完整 Python 流水线,提升反馈速度。
  • 仅 dashboard 相关变更才执行 dashboard build。

可行性:

  • 全部基于 Git 原生命令与 bash,无额外 action 依赖。

4) lint 质量门

执行:

  • uv sync --group dev
  • uv run ruff format --check .
  • uv run ruff check .

触发条件:docs_only != true

预期实践:

  • 代码风格与静态问题前置拦截。

可行性:

  • 与仓库现有 Ruff/uv 规范一致。

5) test 单元测试门

执行:

  • bash ./scripts/run_pytests_ci.sh ./tests

触发条件:docs_only != true

预期实践:

  • 复用仓库既有 CI 测试入口,减少重复逻辑。

可行性:

  • 直接复用现有脚本,维护成本低。

6) smoke 启动可用性门

执行:

  • uv run main.py 启动应用;
  • 轮询 http://localhost:6185 最长 60 秒;
  • trap 保证进程清理。

触发条件:docs_only != true

预期实践:

  • 防止“单测通过但应用无法启动”的回归。

可行性:

  • 与现有 smoke_test 思路一致,风险可控。

7) dashboard 条件构建门

执行:

  • Node 24.13.0
  • pnpm install
  • pnpm run build

触发条件:dashboard_changed == true

预期实践:

  • 避免非 dashboard PR 承担前端构建成本。

可行性:

  • 与当前 dashboard CI 构建链路一致。

8) gate 聚合门(核心)

if: always()
needs: [changes, lint, test, smoke, dashboard]

判定规则:

  • 上游任一 job failure/cancelled -> gate 失败;
  • 否则通过;
  • 同时输出各 job 结果摘要,便于排障。

预期实践:

  • 在分支保护规则中仅需要求一个 Required Check:CI Required Gate
  • reviewer 决策路径从“看多个 workflow”收敛到“看一个门禁 + 失败明细”。

可行性:

  • 已在多个高并发仓库证明有效,且本次实现不改业务代码。

Scope Boundary / 变更边界

本 PR 只新增

  • .github/workflows/ci-required-gate.yml

未修改任何业务代码、测试代码、依赖文件或其它 workflow。


Validation / 验证

本地验证:

  • python3 + pyyaml 解析 workflow 文件,确认 YAML 结构合法。
python3 - <<'PY'
import yaml
yaml.safe_load(open('.github/workflows/ci-required-gate.yml', 'r', encoding='utf-8'))
print('yaml_ok')
PY

结果:yaml_ok


Practical Rollout Plan / 建议落地方式

  1. 先合并该 workflow,观察 3-7 天执行稳定性与耗时。
  2. 在分支规则中将 CI Required Gate 设为 required check。
  3. 再逐步评估是否收敛/调整已有分散 CI(避免重复计算)。

  • This is NOT a breaking change.

Summary by Sourcery

Introduce a unified "CI Required Gate" GitHub Actions workflow that aggregates key quality checks into a single required status for PRs and master pushes.

CI:

  • Add a new CI Required Gate workflow that orchestrates change detection, linting, tests, smoke checks, and conditional dashboard builds into a single gate job.
  • Add a concurrency policy so only the latest run per PR or commit is active, cancelling in-progress runs for older revisions.
  • Introduce a change-scope detection job to shortcut docs-only changes and to trigger dashboard builds only when dashboard files change.
  • Add a composite setup-python-uv GitHub Action to standardize Python and uv setup and optional dependency syncing across CI jobs.

@auto-assign auto-assign bot requested review from Fridemn and Raven95676 March 23, 2026 08:31
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 23, 2026
@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • In the dashboard job, pnpm i --save-dev @types/markdown-it will mutate dev dependencies during CI and diverge from the repo’s lockfile; it would be safer to add this dependency to the project up front (and commit it) instead of installing it dynamically in the workflow.
  • The dashboard job currently installs pnpm globally on every run (npm install pnpm -g); consider switching to pnpm/action-setup (and enabling dependency caching via actions/setup-node) to reduce build time and make the toolchain version explicit.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the `dashboard` job, `pnpm i --save-dev @types/markdown-it` will mutate dev dependencies during CI and diverge from the repo’s lockfile; it would be safer to add this dependency to the project up front (and commit it) instead of installing it dynamically in the workflow.
- The `dashboard` job currently installs `pnpm` globally on every run (`npm install pnpm -g`); consider switching to `pnpm/action-setup` (and enabling dependency caching via `actions/setup-node`) to reduce build time and make the toolchain version explicit.

## Individual Comments

### Comment 1
<location path=".github/workflows/ci-required-gate.yml" line_range="180-27" />
<code_context>
+      - name: Checkout
+        uses: actions/checkout@v6
+
+      - name: Setup Node.js
+        uses: actions/setup-node@v6
+        with:
+          node-version: '24.13.0'
+
</code_context>
<issue_to_address>
**issue (bug_risk):** The specified Node.js version `24.13.0` is unlikely to be available on GitHub runners and may break the workflow.

This value will likely fail because GitHub-hosted runners only provide released Node versions (currently up to v22), so the job may never start. Please use a supported version (e.g. `22.x` or your target LTS) and/or a less specific semver (e.g. `22`) to avoid hard failures when an exact patch isn’t available.
</issue_to_address>

### Comment 2
<location path=".github/workflows/ci-required-gate.yml" line_range="189-190" />
<code_context>
+        run: |
+          cd dashboard
+          npm install pnpm -g
+          pnpm install
+          pnpm i --save-dev @types/markdown-it
+          pnpm run build
+
</code_context>
<issue_to_address>
**suggestion (performance):** Installing `@types/markdown-it` as a devDependency on every CI run is slow and can mutate the lockfile unexpectedly.

This command triggers an extra install and tries to update `package.json`/the lockfile on every CI run, which is both slow and risks drift between local and CI if those changes are ever committed. Instead, add `@types/markdown-it` to `devDependencies` in `package.json` and rely on the existing `pnpm install`/`pnpm install --frozen-lockfile` step so installs remain fast and deterministic.

Suggested implementation:

```
      - name: Build dashboard
        run: |
          cd dashboard
          npm install pnpm -g
          pnpm install
          pnpm run build

```

1. In `dashboard/package.json`, add `@types/markdown-it` under `devDependencies`, for example:
   ```json
   "devDependencies": {
     "@types/markdown-it": "^x.y.z",
     ...
   }
   ```
   Use the version that matches your local environment or the one already used in the project.
2. From the `dashboard` directory, run `pnpm install` locally to update `pnpm-lock.yaml` with the new devDependency and commit both `package.json` and `pnpm-lock.yaml`.
3. If your CI uses `pnpm install --frozen-lockfile` elsewhere, ensure this workflow is consistent with that convention.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Jacobinwwey
Copy link
Author

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The test job currently installs uv but never runs uv sync, which may cause tests to run without the expected dependencies; consider mirroring the lint/smoke jobs’ dependency sync (or otherwise ensuring the test environment is fully prepared) before invoking run_pytests_ci.sh.
  • The dashboard job uses actions/setup-node with node-version: '22.x', while the PR description mentions Node 24.13.0; it would be good to align this with the version actually required/used by the dashboard to avoid subtle build or lockfile issues.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `test` job currently installs `uv` but never runs `uv sync`, which may cause tests to run without the expected dependencies; consider mirroring the `lint`/`smoke` jobs’ dependency sync (or otherwise ensuring the test environment is fully prepared) before invoking `run_pytests_ci.sh`.
- The `dashboard` job uses `actions/setup-node` with `node-version: '22.x'`, while the PR description mentions Node 24.13.0; it would be good to align this with the version actually required/used by the dashboard to avoid subtle build or lockfile issues.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Jacobinwwey
Copy link
Author

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The Python/uv setup is duplicated across lint, test, and smoke jobs; consider extracting this into a reusable workflow or composite action to keep the CI definition DRY and easier to change later.
  • The docs_only detection currently only whitelists docs/, root README*.md, and changelogs/; if other markdown or documentation-like paths (e.g. .github/, docs-*/) should also benefit from the fast path, you may want to expand or centralize these patterns to avoid surprising full CI runs on docs-only changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The Python/uv setup is duplicated across `lint`, `test`, and `smoke` jobs; consider extracting this into a reusable workflow or composite action to keep the CI definition DRY and easier to change later.
- The `docs_only` detection currently only whitelists `docs/`, root `README*.md`, and `changelogs/`; if other markdown or documentation-like paths (e.g. `.github/`, `docs-*/`) should also benefit from the fast path, you may want to expand or centralize these patterns to avoid surprising full CI runs on docs-only changes.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

@SourceryAI SourceryAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The Python setup (checkout, setup-python, pip install uv, and uv sync) is duplicated across lint, test, and smoke jobs; consider factoring this into a composite action or reusable workflow to reduce maintenance overhead and keep the steps in sync.
  • The dashboard job pins Node to 24.13.0, which is quite specific and may not exist or may go stale; consider using a major/minor constraint like 24 (or an LTS alias) plus the pnpm lockfile to keep builds stable while avoiding a brittle patch-level pin.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The Python setup (checkout, setup-python, pip install uv, and uv sync) is duplicated across `lint`, `test`, and `smoke` jobs; consider factoring this into a composite action or reusable workflow to reduce maintenance overhead and keep the steps in sync.
- The dashboard job pins Node to `24.13.0`, which is quite specific and may not exist or may go stale; consider using a major/minor constraint like `24` (or an LTS alias) plus the pnpm lockfile to keep builds stable while avoiding a brittle patch-level pin.

## Individual Comments

### Comment 1
<location path=".github/workflows/ci-required-gate.yml" line_range="87-90" />
<code_context>
+        with:
+          python-version: '3.12'
+
+      - name: Install uv
+        run: |
+          python -m pip install --upgrade pip
+          python -m pip install uv
+
+      - name: Sync dependencies
</code_context>
<issue_to_address>
**suggestion:** The Python setup and `uv` installation are duplicated across multiple jobs; consider consolidating into a reusable workflow or composite action.

The `lint`, `test`, and `smoke` jobs all repeat the same `actions/setup-python` and `python -m pip install uv` steps, which increases maintenance overhead and risk of configuration drift. Consider moving these steps into a composite action (e.g., under `.github/actions`) or a reusable workflow and invoking that from each job to keep configuration consistent and easier to update.
</issue_to_address>

Hi @Jacobinwwey! 👋

Thanks for trying out Sourcery by commenting with @sourcery-ai review! 🚀

Install the sourcery-ai bot to get automatic code reviews on every pull request ✨

Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Jacobinwwey
Copy link
Author

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The Python environment setup (installing uv and syncing deps) is duplicated across lint, test, and smoke; consider extracting this into a reusable workflow/composite action or using a shared cache to avoid repeated installs and speed up CI.
  • The dashboard job pins Node.js to version 24, which is not an LTS release; it may be safer to align this with an LTS version (e.g., 20/22) or whatever version other existing workflows use to avoid subtle version skew.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The Python environment setup (installing uv and syncing deps) is duplicated across `lint`, `test`, and `smoke`; consider extracting this into a reusable workflow/composite action or using a shared cache to avoid repeated installs and speed up CI.
- The `dashboard` job pins Node.js to version `24`, which is not an LTS release; it may be safer to align this with an LTS version (e.g., 20/22) or whatever version other existing workflows use to avoid subtle version skew.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Jacobinwwey
Copy link
Author

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In the composite setup-python-uv action, uv is installed unpinned via python -m pip install uv; consider pinning a specific uv version (or using a hash-locked installer) to avoid future CI instability due to upstream uv changes.
  • The gate job treats any non-failure/non-cancelled result as acceptable, which means skipped results (e.g., docs-only PRs or non-dashboard changes) implicitly pass; if this is intentional, you may want to explicitly surface skipped as an expected state in the summary or narrow needs to only jobs that can be required in each path.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the composite `setup-python-uv` action, uv is installed unpinned via `python -m pip install uv`; consider pinning a specific uv version (or using a hash-locked installer) to avoid future CI instability due to upstream uv changes.
- The `gate` job treats any non-failure/non-cancelled result as acceptable, which means `skipped` results (e.g., docs-only PRs or non-dashboard changes) implicitly pass; if this is intentional, you may want to explicitly surface `skipped` as an expected state in the summary or narrow `needs` to only jobs that can be required in each path.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Jacobinwwey
Copy link
Author

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In the changes job, when changed_files ends up empty (e.g., force-push adjusting commit metadata or odd diff situations), docs_only stays true and will short-circuit lint/tests; consider explicitly treating an empty file list as docs_only=false to avoid silently skipping the main checks in ambiguous cases.
  • The composite setup-python-uv action installs uv via pip on every run; you could speed things up by switching to an official setup-uv action or adding caching around the uv installation so it isn't reinstalled for each job.
  • The dashboard build uses Node.js 24, which is not an LTS release; it may be more robust to align this with the dashboard project's declared supported Node version (often an LTS like 20/22) to reduce the risk of subtle version-specific issues in CI.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the `changes` job, when `changed_files` ends up empty (e.g., force-push adjusting commit metadata or odd diff situations), `docs_only` stays `true` and will short-circuit lint/tests; consider explicitly treating an empty file list as `docs_only=false` to avoid silently skipping the main checks in ambiguous cases.
- The composite `setup-python-uv` action installs `uv` via `pip` on every run; you could speed things up by switching to an official `setup-uv` action or adding caching around the uv installation so it isn't reinstalled for each job.
- The dashboard build uses Node.js `24`, which is not an LTS release; it may be more robust to align this with the dashboard project's declared supported Node version (often an LTS like 20/22) to reduce the risk of subtle version-specific issues in CI.

## Individual Comments

### Comment 1
<location path=".github/workflows/ci-required-gate.yml" line_range="132-136" />
<code_context>
+          sync-deps: 'true'
+          sync-args: '--group dev'
+
+      - name: Startup smoke test
+        shell: bash
+        run: |
+          set -euo pipefail
+          uv run main.py &
+          app_pid=$!
+
</code_context>
<issue_to_address>
**issue (bug_risk):** Smoke test doesn't fail fast when the app exits early

If `uv run main.py` exits early with a non-zero status, the background process will die but the loop will still poll `curl` for up to 60s and only fail with a timeout, hiding the real error and slowing feedback. Inside the loop, also check whether `app_pid` is still running (e.g., via `ps`/`wait -n`) and fail immediately if it has exited.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Jacobinwwey
Copy link
Author

@sourcery-ai review

Copy link

@SourceryAI SourceryAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In .github/actions/setup-python-uv/action.yml, consider quoting the uv sync arguments (e.g., uv sync ${{ inputs.sync-args }}uv sync $SYNC_ARGS with proper quoting) to avoid unexpected word splitting or globbing when multiple or special-character arguments are passed via sync-args.
  • The changes job currently treats any non-docs path (including things like .github/** or misc config files) as non-docs-only and therefore runs the full CI; if this is more conservative than desired, you could explicitly whitelist additional documentation/config paths to keep the fast path effective for those changes as well.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `.github/actions/setup-python-uv/action.yml`, consider quoting the `uv sync` arguments (e.g., `uv sync ${{ inputs.sync-args }}``uv sync $SYNC_ARGS` with proper quoting) to avoid unexpected word splitting or globbing when multiple or special-character arguments are passed via `sync-args`.
- The `changes` job currently treats any non-docs path (including things like `.github/**` or misc config files) as non-docs-only and therefore runs the full CI; if this is more conservative than desired, you could explicitly whitelist additional documentation/config paths to keep the fast path effective for those changes as well.

## Individual Comments

### Comment 1
<location path=".github/workflows/ci-required-gate.yml" line_range="25-26" />
<code_context>
+      docs_only: ${{ steps.detect.outputs.docs_only }}
+      dashboard_changed: ${{ steps.detect.outputs.dashboard_changed }}
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v6
+        with:
+          fetch-depth: 0
</code_context>
<issue_to_address>
**issue (bug_risk):** Using @v6 tags for core GitHub actions will currently fail because those versions do not exist.

This workflow uses `actions/checkout@v6`, `actions/setup-python@v6`, and `actions/setup-node@v6`, but the latest published major versions are currently `checkout@v4`, `setup-python@v5`, and `setup-node@v4`. Please update these to existing versions (or pin to specific SHAs) so the jobs don’t fail at the `uses:` resolution step.
</issue_to_address>

Hi @Jacobinwwey! 👋

Thanks for trying out Sourcery by commenting with @sourcery-ai review! 🚀

Install the sourcery-ai bot to get automatic code reviews on every pull request ✨

Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +25 to +26
- name: Checkout
uses: actions/checkout@v6

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Using @v6 tags for core GitHub actions will currently fail because those versions do not exist.

This workflow uses actions/checkout@v6, actions/setup-python@v6, and actions/setup-node@v6, but the latest published major versions are currently checkout@v4, setup-python@v5, and setup-node@v4. Please update these to existing versions (or pin to specific SHAs) so the jobs don’t fail at the uses: resolution step.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 未把 actions/checkout|setup-python|setup-node 从 @v6 改回旧版本。
    原因:当前官方仓库已存在 v6 标签(可解析),该建议前提不成立,改回旧版本无必要。
  2. 未扩大 docs_only 白名单(如 .github/**)。
    原因:当前“保守触发完整 CI”的策略更安全,避免配置类变更被误判为 docs-only。
  3. 未把 dashboard 的 Node 从 24 改到 LTS。
    原因:当前仓库 dashboard/release 现有主链路使用 Node 24 系,保持一致性优先。

@Jacobinwwey
Copy link
Author

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The workflow references several GitHub Actions with non-existent major versions (e.g., actions/checkout@v6, actions/setup-python@v6, actions/setup-node@v6), which will fail at runtime—these should be updated to the latest supported majors (currently @v4 for checkout, @v5 for setup-python, @v4 for setup-node, etc.).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The workflow references several GitHub Actions with non-existent major versions (e.g., `actions/checkout@v6`, `actions/setup-python@v6`, `actions/setup-node@v6`), which will fail at runtime—these should be updated to the latest supported majors (currently `@v4` for checkout, `@v5` for setup-python, `@v4` for setup-node, etc.).

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Jacobinwwey
Copy link
Author

未把 actions/checkout|setup-python|setup-node 从 @v6 改回旧版本。
原因:当前官方仓库已存在 v6 标签(可解析),该建议前提不成立,改回旧版本无必要。

@Jacobinwwey
Copy link
Author

  1. 官方 Tags API 校验(来源:GitHub REST)

gh api repos/actions/checkout/tags --jq '.[0:12][] | .name'
gh api repos/actions/setup-python/tags --jq '.[0:12][] | .name'
gh api repos/actions/setup-node/tags --jq '.[0:12][] | .name'

结果都包含 v6 与对应 v6.x.y。

  1. 官方 Git refs API 校验(验证 v6 是否真指向 commit)

gh api repos/actions/checkout/git/ref/tags/v6
gh api repos/actions/setup-python/git/ref/tags/v6
gh api repos/actions/setup-node/git/ref/tags/v6

返回均为 object.type=commit.

  1. Git 协议独立校验(不依赖 REST)

git ls-remote --refs --tags https://github.com/actions/checkout.git 'refs/tags/v6*'
git ls-remote --refs --tags https://github.com/actions/setup-python.git 'refs/tags/v6*'
git ls-remote --refs --tags https://github.com/actions/setup-node.git 'refs/tags/v6*'

可直接看到 refs/tags/v6 及 refs/tags/v6.x.y。

  1. 可用性校验(按 v6 直接拉源码)

curl -I https://codeload.github.com/actions/checkout/zip/refs/tags/v6
curl -I https://codeload.github.com/actions/setup-python/zip/refs/tags/v6
curl -I https://codeload.github.com/actions/setup-node/zip/refs/tags/v6

HTTP 都是 200。

  1. Action 元数据校验(action.yml 可直取)

curl https://raw.githubusercontent.com/actions/checkout/v6/action.yml
curl https://raw.githubusercontent.com/actions/setup-python/v6/action.yml
curl https://raw.githubusercontent.com/actions/setup-node/v6/action.yml

都返回 200 且内容有效。

@sourcery-ai

@Jacobinwwey
Copy link
Author

[Nearly Passed the review by Sourcery]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants