Skip to content

fix: use rc-test npm workflow for CI#175

Merged
afc163 merged 3 commits into
masterfrom
fix/ci-workflow
Jun 16, 2026
Merged

fix: use rc-test npm workflow for CI#175
afc163 merged 3 commits into
masterfrom
fix/ci-workflow

Conversation

@afc163

@afc163 afc163 commented Jun 16, 2026

Copy link
Copy Markdown
Member

Switch from the bun-based rc-test test.yml to test-npm.yml (uses npm, not bun). This project uses father build + umi-test, compatible with test-npm.yml's npm-based steps.

The external workflow react-component/rc-test/.github/workflows/test.yml@main
has switched to bun (oven-sh/setup-bun), but this project uses npm.
Switch to a self-contained workflow that runs:
- actions/checkout@v4
- actions/setup-node@v4 (Node 18)
- npm ci
- npm run lint
- npm run lint:tsc
- npm run compile
- npm test
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
compatible Error Error Jun 16, 2026 8:07am

Request Review

@gemini-code-assist

Copy link
Copy Markdown

Note

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

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

CI 工作流文件将测试作业从调用外部可复用工作流(react-component/rc-test/.../test.yml@main)改为在本仓库内直接定义,指定 ubuntu-latest 环境并依次执行 checkout、Node.js 18 配置、npm ci、lint、lint:tsc、compile 及单元测试。

Changes

CI 工作流内联化

Layer / File(s) Summary
内联 CI 测试步骤
.github/workflows/react-component-ci.yml
删除对外部可复用工作流的调用及 secrets: inherit,改为在本文件内声明 runs-on: ubuntu-latest 及完整的 checkout/setup-node/npm ci/lint/lint:tsc/compile/test 步骤序列。

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 小兔跳过外部的云,
把步骤搬回家门,
lint 和 test 亲自跑,
Node 18 齐欢欣,
CI 归家不再借别人! 🏠

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning 标题声称使用 rc-test npm 工作流,但实际上 PR 做的是将外部工作流替换为自包含的本地工作流以解决 bun/npm 兼容性问题。 建议更新标题为更准确的描述,如 'fix: replace external rc-test workflow with self-contained npm CI workflow' 或 'fix: migrate CI to npm-based workflow to fix bun incompatibility'
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-workflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Use actions/checkout@v4 and actions/setup-node@v4 (current versions)
- Add cache: npm for faster installs
- Use node 20 LTS for better compatibility
- Add --forceExit to npm test to prevent hanging in CI

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/react-component-ci.yml:
- Around line 7-8: The GitHub Action references for actions/checkout and
actions/setup-node are pinned to floating version tags (`@v4`) rather than
specific commit SHAs, creating a supply chain security risk where upstream tag
redirection could execute unaudited code. Replace the floating `@v4` tags with the
full commit SHA for the latest stable release of each action. Obtain the commit
SHAs from the official GitHub releases pages for actions/checkout and
actions/setup-node, then update both uses statements to reference the specific
commit SHA instead of the version tag.
- Line 7: The actions/checkout@v4 action on line 7 does not explicitly disable
credential persistence, which leaves the GITHUB_TOKEN exposed in .git/config for
potential misuse by subsequent workflow steps. Since this workflow only performs
code pulling (npm ci, lint, and test) without any git push operations, add the
`persist-credentials: false` parameter to the checkout action to explicitly
prevent the GITHUB_TOKEN from being stored in the git configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a736a566-3cf9-4084-bd87-e4a28dc0d01c

📥 Commits

Reviewing files that changed from the base of the PR and between 8a846ba and c8fd975.

📒 Files selected for processing (1)
  • .github/workflows/react-component-ci.yml

secrets: inherit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/react-component-ci.yml | head -20

Repository: ant-design/compatible

Length of output: 498


🌐 Web query:

actions/checkout persist-credentials security GitHub token

💡 Result:

Summary

The persist-credentials setting in actions/checkout has significant security implications for GitHub token handling:

Default Behavior

By default, persist-credentials is set to true in actions/checkout, which means the action stores the GITHUB_TOKEN in .git/config.

Security Risks

This means any subsequent step in the workflow can access the token, even if it doesn't need git push capabilities. Additional risks include:

  • Any later step or third-party action can read ~/.git-credentials or the Git credential helper and use the GITHUB_TOKEN to make API calls or push commits
  • If this file is not excluded from packaging and build processes, it could be exfiltrated out of the Actions runner into Docker images or other publicly available artifacts

Mitigation

Setting persist-credentials: false on checkout steps that don't require git push reduces the attack surface by preventing credential theft through compromised dependencies or scripts.

The token is removed during post-job cleanup. Set persist-credentials: false to opt-out.

Recommendation

Remove or set persist-credentials to false unless explicitly needed, particularly for workflows that only read code like tests, builds, and scans. Keep it enabled only for workflows that genuinely need to push commits back to the repository.

Citations:


关闭 checkout 的凭据持久化,减少 GITHUB_TOKEN 暴露面。

Line 7 未设置 persist-credentials: false。由于该工作流仅需拉取代码(执行 npm ci、lint 和 test),不涉及 git push,建议显式关闭凭据持久化。默认配置下,GITHUB_TOKEN 会被存储在 .git/config 中,后续步骤中的任何操作都可能访问到该凭据。

建议补丁
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@v4
+        with:
+          persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
persist-credentials: false
🧰 Tools
🪛 zizmor (1.25.2)

[warning] 7-7: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 7-7: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/react-component-ci.yml at line 7, The actions/checkout@v4
action on line 7 does not explicitly disable credential persistence, which
leaves the GITHUB_TOKEN exposed in .git/config for potential misuse by
subsequent workflow steps. Since this workflow only performs code pulling (npm
ci, lint, and test) without any git push operations, add the
`persist-credentials: false` parameter to the checkout action to explicitly
prevent the GITHUB_TOKEN from being stored in the git configuration.

Source: Linters/SAST tools

Comment thread .github/workflows/react-component-ci.yml Outdated
React to react-component/rc-test/.github/workflows/test-npm.yml@main,
which uses npm (not bun) and runs:
  npm i --legacy-peer-deps
  npm run lint
  npx tsc --noEmit
  npm run compile
  npm run test -- --coverage
@afc163 afc163 changed the title fix: use self-contained CI workflow fix: use rc-test npm workflow for CI Jun 16, 2026
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.46%. Comparing base (f56dbe6) to head (2a814e1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #175   +/-   ##
=======================================
  Coverage   43.46%   43.46%           
=======================================
  Files          21       21           
  Lines         398      398           
  Branches      101      101           
=======================================
  Hits          173      173           
  Misses        225      225           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@afc163 afc163 merged commit 7ccea5a into master Jun 16, 2026
8 of 9 checks passed
@afc163 afc163 deleted the fix/ci-workflow branch June 16, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant