Skip to content

ci: check node matches latest upstream tag#1934

Merged
JesusPaz merged 1 commit intomasterfrom
jesus/check-latest-node-tag
Apr 14, 2026
Merged

ci: check node matches latest upstream tag#1934
JesusPaz merged 1 commit intomasterfrom
jesus/check-latest-node-tag

Conversation

@JesusPaz
Copy link
Copy Markdown
Contributor

@JesusPaz JesusPaz commented Apr 14, 2026

Summary by CodeRabbit

  • Chores
    • Updated CI workflow checkout action to the latest supported version.
    • Added a Node.js validation step in build workflows that compares the installed Node version with the latest official release per major, reporting up‑to‑date, skipped, or warning statuses in the build summary.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Walkthrough

Updated GitHub checkout action from v4 to v5 across three CI jobs and added a validation step that fetches Node.js release metadata, compares the installed Node version to the latest official release for the major version, and reports status to GITHUB_STEP_SUMMARY.

Changes

Cohort / File(s) Summary
CI Workflow Configuration
.github/workflows/ci.yaml
Updated actions/checkout from v4 to v5 in deb, rpm, and rpm-minimal jobs. Added Validate Node matches latest official tag step that fetches https://nodejs.org/dist/index.json, selects latest release for the target major, compares to process.version, and appends up to date / WARNING / NodeSource package is behind upstream / skipped statuses to GITHUB_STEP_SUMMARY. Also applied a whitespace-only hunk near the existing Validate Node Version step.

Sequence Diagram

sequenceDiagram
    participant Job as CI Job
    participant API as nodejs.org API
    participant Summary as GitHub Step Summary

    Job->>API: GET /dist/index.json
    API-->>Job: Release metadata (JSON)
    Note over Job: Select latest release matching major
    alt Release found
        Job->>Job: Compare installed process.version with latest
        alt Versions match
            Job->>Summary: Append "up to date" entry
        else Versions differ
            Job->>Summary: Append "WARNING / NodeSource package is behind upstream"
        end
    else No release for major
        Job->>Summary: Append "skipped" entry
    end
    Job-->>Job: Exit success
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 I hopped through CI with a curious cheer,
I nudged checkout to five and fetched releases near,
I checked Node's tag, and wrote what I see,
"Up to date" or "Warning" — stamped in summary, whee! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a validation step to check if the installed Node.js version matches the latest upstream tag.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jesus/check-latest-node-tag

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/ci.yaml (1)

50-86: Extract the latest-tag checker into one reusable script or composite action.

This block is copied three times with identical logic. Any follow-up fix to exit behavior, parsing, or summary formatting now has to be kept in sync manually across all jobs.

One way to simplify it
-      - name: Validate Node matches latest official tag
-        env:
-          MATRIX_OS: ${{ matrix.os }}
-        run: |
-          cat <<'EOF' > /tmp/check-latest.js
-          ...
-          EOF
-          node /tmp/check-latest.js ${{ matrix.version }} "$MATRIX_OS"
+      - name: Validate Node matches latest official tag
+        env:
+          MATRIX_OS: ${{ matrix.os }}
+        run: node .github/scripts/check-latest-node.js ${{ matrix.version }} "$MATRIX_OS"

Then reuse the same script from deb, rpm, and rpm-minimal.

Also applies to: 144-180, 237-273

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yaml around lines 50 - 86, The workflow duplicates the
inline Node latest-tag checker across multiple jobs; extract the logic currently
written into /tmp/check-latest.js (symbols: major, appendSummary, retrieval of
https://nodejs.org/dist/index.json and comparison against process.version) into
a single reusable artifact (either a checked-in script in the repo or a
composite GitHub Action) and replace the three inline blocks (used by deb, rpm,
rpm-minimal jobs) with calls to that single script/action, ensuring the same CLI
args (matrix.version, MATRIX_OS) and summary/error exit behavior are preserved.
🤖 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.yaml:
- Around line 74-83: The workflow currently exits with process.exit(0) on both a
detected stale NodeSource package and on fetch errors, making CI succeed even
when validation fails; update the exit calls in the version-comparison branch
(the block that checks if (installed !== latest.version)) and the fetch error
handler (the .on('error', ...) callback) to use a non-zero exit code (e.g.,
process.exit(1)) so the job fails on stale packages or fetch/validation
failures; apply the same change to the corresponding other instances referenced
(the blocks around lines 168-177 and 261-270) where process.exit(0) is used for
error/failure conditions.

---

Nitpick comments:
In @.github/workflows/ci.yaml:
- Around line 50-86: The workflow duplicates the inline Node latest-tag checker
across multiple jobs; extract the logic currently written into
/tmp/check-latest.js (symbols: major, appendSummary, retrieval of
https://nodejs.org/dist/index.json and comparison against process.version) into
a single reusable artifact (either a checked-in script in the repo or a
composite GitHub Action) and replace the three inline blocks (used by deb, rpm,
rpm-minimal jobs) with calls to that single script/action, ensuring the same CLI
args (matrix.version, MATRIX_OS) and summary/error exit behavior are preserved.
🪄 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: c2a90072-48d6-4f7e-844e-362cd1065528

📥 Commits

Reviewing files that changed from the base of the PR and between c6e581b and d8d268a.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml

Comment thread .github/workflows/ci.yaml
@JesusPaz JesusPaz force-pushed the jesus/check-latest-node-tag branch from d8d268a to ec18e8c Compare April 14, 2026 15:27
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/ci.yaml (1)

50-85: Extract this validator into one reusable script or action.

The same inline JS now exists in three jobs, so every fix has to be copied three times. That's already why the same exit-code bug shows up in all three blocks.

Also applies to: 143-178, 235-270

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yaml around lines 50 - 85, Extract the duplicated
inline validator into a single reusable script (e.g.,
.github/scripts/check-latest.js) or a composite action and replace each inline
block that writes /tmp/check-latest.js (the step named "Validate Node matches
latest official tag") with a call to that script/action, passing matrix.version
and MATRIX_OS; move the existing logic from the inline snippet into that file,
ensure it writes summaries via process.env.GITHUB_STEP_SUMMARY, and fix the
exit-code behavior so the script returns a non-zero code on real errors and the
intended zero/neutral code only when skipping (preserve current logging/warning
behavior but make exit codes consistent).
🤖 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.yaml:
- Around line 80-81: The success branches that currently only call console.log
(e.g. the lines printing "Installed ... matches latest ...") never call
appendSummary(), leaving GITHUB_STEP_SUMMARY empty; update those success paths
to also call appendSummary() with the same or equivalent success message so
healthy runs populate the matrix summary (mirror the behavior used in the
skip/warning branches that call appendSummary()). Locate the success console.log
occurrences and add a corresponding appendSummary() invocation that writes the
success text to the step summary.
- Around line 61-63: The https.get() calls currently don't handle request
timeouts and can leave CI hanging; update each invocation (the ClientRequest
returned by https.get at the three occurrences) to set a timeout (e.g.,
setTimeout duration appropriate for CI) and in the timeout handler explicitly
destroy the request/socket and surface an error (for example by calling
req.destroy(new Error('Request timed out')) or emitting an error) so the
promise/callback path fails fast; also attach an 'error' listener on the
ClientRequest to ensure the error is logged/propagated (refer to the existing
https.get(...) calls and their response handlers/res.on('data', ...) to add
req.setTimeout(...) / req.on('timeout', ...) and req.on('error', ...) handling).

---

Nitpick comments:
In @.github/workflows/ci.yaml:
- Around line 50-85: Extract the duplicated inline validator into a single
reusable script (e.g., .github/scripts/check-latest.js) or a composite action
and replace each inline block that writes /tmp/check-latest.js (the step named
"Validate Node matches latest official tag") with a call to that script/action,
passing matrix.version and MATRIX_OS; move the existing logic from the inline
snippet into that file, ensure it writes summaries via
process.env.GITHUB_STEP_SUMMARY, and fix the exit-code behavior so the script
returns a non-zero code on real errors and the intended zero/neutral code only
when skipping (preserve current logging/warning behavior but make exit codes
consistent).
🪄 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: 56b3be4a-3f54-4f62-90a7-fa7aaf111e19

📥 Commits

Reviewing files that changed from the base of the PR and between d8d268a and ec18e8c.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml

Comment thread .github/workflows/ci.yaml
Comment thread .github/workflows/ci.yaml
@JesusPaz JesusPaz merged commit 279cfb8 into master Apr 14, 2026
57 checks passed
@JesusPaz JesusPaz deleted the jesus/check-latest-node-tag branch April 14, 2026 15:56
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.

2 participants