Skip to content

Enable caching of npm install/npm ci for setup-node action #1457

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

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

jeffwidman
Copy link
Member

The setup-node action now supports caching the results of npm install/npm ci:
https://github.blog/changelog/2021-07-02-github-actions-setup-node-now-supports-dependency-caching/

@Copilot Copilot AI review requested due to automatic review settings April 11, 2025 23:00
@jeffwidman jeffwidman requested a review from a team as a code owner April 11, 2025 23:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables caching for npm dependencies in GitHub Actions workflows by leveraging the setup-node action's new caching support.

  • Enables caching for npm commands by adding "cache: 'npm'" to the setup-node action.
  • Simplifies workflow steps by removing the redundant "name: Setup Node.js" fields.
  • Applies changes consistently across multiple workflow configuration files.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
.github/workflows/test.yml Updated setup-node step to cache npm dependencies
.github/workflows/integration-test.yml Added caching for npm in the setup-node step
.github/workflows/dependabot-build.yml Enabled npm caching and removed explicit step name
.github/workflows/check-dist.yml Applied caching configuration for npm dependencies
Comments suppressed due to low confidence (4)

.github/workflows/test.yml:16

  • [nitpick] Consider adding an explicit step name (e.g., 'Setup Node.js with caching') to improve clarity in workflow logs.
- uses: actions/setup-node@v4

.github/workflows/integration-test.yml:20

  • [nitpick] Adding a descriptive step name for the setup-node action can enhance the readability of the workflow logs.
- uses: actions/setup-node@v4

.github/workflows/dependabot-build.yml:37

  • [nitpick] Consider reintroducing a step name for the setup-node action to make the workflow easier to navigate in logs.
- uses: actions/setup-node@v4

.github/workflows/check-dist.yml:17

  • [nitpick] It might be beneficial to add a step name for clarity in the workflow log outputs, such as 'Setup Node.js with cache enabled'.
- uses: actions/setup-node@v4

@jeffwidman jeffwidman force-pushed the remove-unneeded-ref-hardcoding branch 2 times, most recently from d1a760e to 787f5ec Compare April 14, 2025 17:27
Base automatically changed from remove-unneeded-ref-hardcoding to main April 14, 2025 17:30
@jeffwidman jeffwidman merged commit 664562a into main Apr 14, 2025
9 checks passed
@jeffwidman jeffwidman deleted the add-npm-caching branch April 14, 2025 18:22
@@ -32,16 +32,14 @@ jobs:
# Check out using a PAT so any pushed changes will trigger checkruns
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
Copy link
Member Author

Choose a reason for hiding this comment

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

This was a leftover that I'd forgotten to remove as part of:

So removed it here.

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