-
Notifications
You must be signed in to change notification settings - Fork 4
Update actions/setup-node action to v6 #62
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ jobs: | |
| git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
|
|
||
| - name: Setup Node (PR Summary) | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | ||
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | ||
| with: | ||
| node-version-file: source-folder/.tool-versions | ||
| cache: npm | ||
|
|
@@ -43,7 +43,7 @@ jobs: | |
| npm prune --omit=dev | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than running - run: npm ci --omit=dev |
||
|
|
||
| - name: Setup Node (PR Review) | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | ||
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | ||
| with: | ||
| node-version-file: source-folder/.tool-versions | ||
| cache: npm | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ jobs: | |
| - name: Checkout source branch | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | ||
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | ||
|
Comment on lines
23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The checkout and setup-node actions are pinned to commit SHAs. It’s more common to use tagged versions for clarity and easier upgrades. For example: - uses: actions/checkout@v3
- uses: actions/setup-node@v6
with:
node-version-file: .tool-versions
cache: npm |
||
| with: | ||
| node-version-file: .tool-versions | ||
| cache: npm | ||
|
|
@@ -47,7 +47,7 @@ jobs: | |
| - name: Checkout source branch | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | ||
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | ||
| with: | ||
| node-version-file: .tool-versions | ||
| cache: npm | ||
|
Comment on lines
47
to
53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have duplicate checkout and setup-node steps. To DRY up this workflow, you could extract common steps into a reusable workflow or use YAML anchors. For example: # Define anchors at the top
defaults: &checkout-and-setup
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v6
with:
node-version-file: .tool-versions
cache: npm
# Reuse anchors in jobs
jobs:
pr-lint:
runs-on: ubuntu-latest
<<: *checkout-and-setup
steps:
- run: npm ci
- run: npm run lint
code-scan:
runs-on: ubuntu-latest
<<: *checkout-and-setup
steps:
- run: npm ci
- run: npm run code-scan |
||
|
|
||
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 using a semantic version tag instead of a full commit SHA for actions/setup-node. This improves readability and makes upgrades easier. For example: