-
Notifications
You must be signed in to change notification settings - Fork 3
Update actions/setup-node action to v5 #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This update bumps the GitHub Actions Walkthrough
Model: o4-mini | Prompt Tokens: 756 | Completion Tokens: 647 |
bc9b2a3 to
9989323
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We’ve put together a friendly code review powered by AI that highlights potential improvements and offers insights. Treat these suggestions as ideas, not hard rules, and choose what fits your approach. Ultimately your judgment guides the process, and AI is here to lend a hand.
Model: o4-mini | Prompt Tokens: 2542 | Completion Tokens: 5692
| - name: Setup Node (PR Summary) | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider switching from a full commit SHA to a semantic version tag for easier maintenance and automatic patch updates. For example, instead of pinning to a specific SHA, you can use the v5 major release tag:
- uses: actions/setup-node@v5
with:
node-version-file: source-folder/.tool-versions
cache: npm| - name: Setup Node (PR Review) | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | ||
| with: | ||
| node-version-file: source-folder/.tool-versions | ||
| cache: npm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two Setup Node steps are identical except for their names. You can DRY this up by using a YAML anchor or by extracting the common setup into a reusable workflow or composite action. For example, with a YAML anchor:
# Define the anchor at the top of your steps
x-setup-node: &setup-node
uses: actions/setup-node@v5
with:
node-version-file: source-folder/.tool-versions
cache: npm
# Reuse it in both steps
- name: Setup Node (PR Summary)
<<: *setup-node
- name: Setup Node (PR Review)
<<: *setup-node| - name: Checkout source branch | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have two Checkout source branch steps that are identical. Consider moving it to a shared set of steps or a job-level definition to avoid duplication:
jobs:
code-quality:
steps:
- name: Checkout source branch
uses: actions/checkout@v5
# other steps...| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the build workflow, use a semantic version tag for actions/setup-node instead of a full SHA. This ensures you receive non-breaking updates automatically:
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version-file: .tool-versions
cache: npm|
This update standardizes the Node.js setup across CI workflows by moving to the latest setup-node action, bumps the local Node.js version, and refreshes linting and TypeScript development dependencies for both PR tools, ensuring consistency and up-to-date tooling. Walkthrough
Model: o4-mini | Prompt Tokens: 1279 | Completion Tokens: 603 | Diff Range: bc9b2a3...9989323 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expert review powered by AI offers friendly insights into your code. These recommendations are predictions and may not be foolproof, so choose what aligns best with your approach. You control the final decisions—AI is here to support and empower your unique process.
Model: o4-mini | Prompt Tokens: 1271 | Completion Tokens: 3086
| - name: Setup Node (PR Summary) | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You’re pinning actions/setup-node to a commit SHA for v5.0.0, which prevents you from getting future non-breaking patches. It’s better to use the semver tag to automatically receive minor and patch updates while still locking major:
- uses: actions/setup-node@v5
with:
node-version-file: source-folder/.tool-versions
cache: npm| - name: Setup Node (PR Summary) | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | ||
| with: | ||
| node-version-file: source-folder/.tool-versions | ||
| cache: npm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “Setup Node” step is duplicated in both PR Summary and PR Review jobs. To follow the DRY principle and avoid future inconsistencies, extract it into a reusable YAML anchor or a composite action. For example:
# Top of your workflow
x-steps:
setup-node: &setup-node
uses: actions/setup-node@v5
with:
node-version-file: source-folder/.tool-versions
cache: npm
# Then in each job
steps:
- name: Setup Node
<<: *setup-nodeThis reduces duplication and makes upgrades simpler.
| with: | ||
| node-version-file: source-folder/.tool-versions | ||
| cache: npm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make your cache invalidation more precise, leverage the cache-dependency-path input so the cache key changes when your lockfile updates. For example:
- uses: actions/setup-node@v5
with:
node-version-file: source-folder/.tool-versions
cache: 'npm'
cache-dependency-path: source-folder/package-lock.json # ✅ ensures cache bust when deps change| - name: Checkout source branch | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You’ve pinned actions/checkout to a full commit SHA. Using a semver tag (e.g. @v3) is more maintainable and still locks major versions:
- uses: actions/checkout@v3| - name: Checkout source branch | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | ||
| with: | ||
| node-version-file: .tool-versions | ||
| cache: npm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “Checkout source branch” and “Setup Node” steps appear twice, leading to repetition. Consider using YAML anchors or a reusable workflow to DRY them:
# Define anchors at top
x-steps:
checkout: &checkout
name: Checkout source branch
uses: actions/checkout@v3 # or your preferred tag
setup-node: &setup-node
name: Setup Node
uses: actions/setup-node@v5
with:
node-version-file: .tool-versions
cache: npm
# Then in your jobs
steps:
- <<: *checkout
- <<: *setup-node
# ... other steps
This PR contains the following updates:
v4.4.0->v5.0.0Release Notes
actions/setup-node (actions/setup-node)
v5.0.0Compare Source
What's Changed
Breaking Changes
Make sure your runner is updated to this version or newer to use this release. v2.327.1 Release Notes
Dependency Upgrades
Enhancement:
New Contributors
Full Changelog: actions/setup-node@v4...v5.0.0
Configuration
📅 Schedule: Branch creation - "every weekend" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.