chore: CI improvements#402
Conversation
📝 WalkthroughWalkthroughThe PR restructures the CI/CD pipeline to dynamically detect changed packages and conditionally run tests only for affected packages, while moving the lint step earlier in the common workflow. Documentation updates clarify Node.js version support requirements and improve README formatting across multiple packages. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
.github/workflows/ci.yml (2)
26-26: Addshell: bashto explicitly declare the required shell for the bash-specificdetectstep.
declare -A(associative arrays) is a bash feature and will fail under/bin/sh. While GitHub Actions defaults tobashon Linux runners, making the dependency explicit prevents confusion and guards against runner environment changes.♻️ Proposed fix
- name: Detect changed packages id: detect env: ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + shell: bash run: |🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml at line 26, The CI step named "detect" uses bash-specific syntax (`declare -A` associative arrays) but doesn't specify the shell; update the "detect" step to add an explicit `shell: bash` attribute so the runner uses bash instead of sh, ensuring `declare -A` and other bash-only constructs execute correctly; locate the step by its name "detect" and add the `shell: bash` key at the same level as `run`.
27-47: ThePATH_TO_NAMEmap is currently complete, but adding a self-validation step would safeguard against future maintenance gaps.The map currently lists all 12 packages in the repository and matches the actual package names exactly. However, if a new package is added under
packages/without updating the map, its tests will silently be skipped with no warning. Consider adding a validation step in the CI workflow that cross-references the map against actualpackages/*/package.jsonnames to catch this automatically.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 27 - 47, Add a CI validation step after declaring PATH_TO_NAME that enumerates actual packages under packages/* by reading each package.json name and ensures each package path exists in PATH_TO_NAME and that PATH_TO_NAME[path] equals the package.json name; if any package is missing from PATH_TO_NAME or the names differ, print the mismatches and exit non‑zero to fail the workflow. Use the existing PATH_TO_NAME, PACKAGES, and ALL_CHANGED_FILES symbols to locate where to add this check and to report any found discrepancies so the mapping stays in sync with repository packages.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 70-72: The automerge job's conditional allows running when general
is skipped, so update the if expression to require successful upstream jobs:
replace the current if (always() && (needs.general.result == 'success' ||
needs.general.result == 'skipped')) with an expression that requires
needs.general.result == 'success' and also checks the changed-files-job
succeeded (e.g. always() && needs.general.result == 'success' &&
needs.changed-files-job.result == 'success') so automerge cannot run when
changed-files-job or general failed or was skipped.
- Around line 10-20: The changed-files-job uses the tj-actions/changed-files
action which requires a local git checkout for push events; add an
actions/checkout step (with fetch-depth: 0) immediately before the step with id
changed-files (the step that uses
tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c) so the action
can access the full git history and correctly detect changes for packages/**.
- Around line 18-20: The workflow pins tj-actions/changed-files to a potentially
unsafe SHA (ed68ef82c095e0d48ec87eccea555d944a631a4c) on the uses:
tj-actions/changed-files@... line; verify that this SHA is from the v46.0.1 (or
later on v46) release tag and update it if not, or upgrade the action to v47.0.4
and pin its authoritative commit SHA instead (replace the current uses value
with tj-actions/changed-files@<secure-commit-sha> or the verified v46.0.1+
commit), then re-run CI and, if the workflow ran during March 14–15, 2025, audit
logs and rotate any exposed secrets.
In `@README.md`:
- Around line 9-11: The multiline blockquote in README.md is broken because the
continuation line "Please use a later version of Node.js." is missing the
leading ">"; update the second line so it also begins with ">" to keep it inside
the same callout as the "> **Note:**" line, ensuring the entire note renders as
a single blockquote.
---
Nitpick comments:
In @.github/workflows/ci.yml:
- Line 26: The CI step named "detect" uses bash-specific syntax (`declare -A`
associative arrays) but doesn't specify the shell; update the "detect" step to
add an explicit `shell: bash` attribute so the runner uses bash instead of sh,
ensuring `declare -A` and other bash-only constructs execute correctly; locate
the step by its name "detect" and add the `shell: bash` key at the same level as
`run`.
- Around line 27-47: Add a CI validation step after declaring PATH_TO_NAME that
enumerates actual packages under packages/* by reading each package.json name
and ensures each package path exists in PATH_TO_NAME and that PATH_TO_NAME[path]
equals the package.json name; if any package is missing from PATH_TO_NAME or the
names differ, print the mismatches and exit non‑zero to fail the workflow. Use
the existing PATH_TO_NAME, PACKAGES, and ALL_CHANGED_FILES symbols to locate
where to add this check and to report any found discrepancies so the mapping
stays in sync with repository packages.
Summary by CodeRabbit
Documentation
Chores