Skip to content

fix(ci): allow supported actions/cache major versions - #39

Open
hoang12122 wants to merge 1 commit into
mainfrom
fix/cache-action-version-invariant
Open

fix(ci): allow supported actions/cache major versions#39
hoang12122 wants to merge 1 commit into
mainfrom
fix/cache-action-version-invariant

Conversation

@hoang12122

@hoang12122 hoang12122 commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Vấn đề

PR #38 nâng actions/cache từ v4 lên v6, nhưng scripts/check-operational-performance-invariants.mjs đang kiểm tra cứng chuỗi actions/cache@v4. Vì vậy cache thực tế chạy thành công nhưng operational performance gate vẫn thất bại.

Thay đổi

  • Thay kiểm tra chuỗi cố định bằng biểu thức nhận diện phiên bản major của actions/cache.
  • Chấp nhận các phiên bản từ v4 trở lên.
  • Bổ sung kiểm tra rõ ràng rằng workflow vẫn cache đúng thư mục ~/.npm.
  • Giữ nguyên yêu cầu cache key phải dùng hashFiles('package.json') và quy trình cài đặt không tạo lockfile.

Kết quả mong đợi

Sau khi PR này được merge và PR #38 được rebase/cập nhật, step Verify operational performance invariants sẽ không còn thất bại chỉ vì nâng phiên bản actions/cache.

Summary by CodeRabbit

  • Tests
    • Improved workflow validation for npm artifact caching.
    • Ensures supported cache action versions are used while continuing to verify npm cache coverage.
    • Preserved successful validation reporting.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The operational performance invariant script now accepts actions/cache versions newer than or equal to v4 while continuing to require npm artifact caching and the existing success message.

Changes

Operational Performance Validation

Layer / File(s) Summary
Cache action version check
scripts/check-operational-performance-invariants.mjs
The workflow assertion extracts the actions/cache@v<major> version, requires major version 4 or newer, preserves the ~/.npm cache requirement, and retains the PASS output.

Estimated code review effort: 2 (Simple) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: relaxing the CI check to allow supported actions/cache major versions.
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.
✨ 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/cache-action-version-invariant

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

@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: 1

🤖 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 `@scripts/check-operational-performance-invariants.mjs`:
- Around line 40-44: The cache invariant currently validates the actions/cache
version and npm path independently, allowing commented or mismatched steps to
pass. Update the validation around cacheActionMatch and requireText to parse or
isolate the same non-commented actions/cache@v4+ step, and require that step
itself to configure path: ~/.npm.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: a3b6c9b2-09fd-4060-a4a8-f09ee5f50753

📥 Commits

Reviewing files that changed from the base of the PR and between 2de1d44 and a2336fc.

📒 Files selected for processing (1)
  • scripts/check-operational-performance-invariants.mjs

Comment on lines +40 to +44
const cacheActionMatch = workflow.match(/uses:\s*actions\/cache@v(\d+)\b/);
if (!cacheActionMatch || Number(cacheActionMatch[1]) < 4) {
failures.push('Workflow must use a supported actions/cache version for npm download artifacts.');
}
requireText(workflow, 'path: ~/.npm', 'Workflow must cache the npm download directory.');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Validate the active cache step as one unit.

These independent text searches can pass on a commented-out uses:/path: pair or on two different steps, so the invariant may report success without an active actions/cache@v4+ step caching ~/.npm. Parse the workflow or scope both assertions to the same non-commented cache step.

🤖 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 `@scripts/check-operational-performance-invariants.mjs` around lines 40 - 44,
The cache invariant currently validates the actions/cache version and npm path
independently, allowing commented or mismatched steps to pass. Update the
validation around cacheActionMatch and requireText to parse or isolate the same
non-commented actions/cache@v4+ step, and require that step itself to configure
path: ~/.npm.

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