Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

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:

- uses: actions/setup-node@v6
  with:
    node-version-file: source-folder/.tool-versions
    cache: npm

with:
node-version-file: source-folder/.tool-versions
cache: npm
Expand All @@ -43,7 +43,7 @@ jobs:
npm prune --omit=dev

Choose a reason for hiding this comment

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

Rather than running npm prune --omit=dev after install, you can use npm ci --omit=dev for a clean, faster install of only production dependencies:

- 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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Choose a reason for hiding this comment

The 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
Expand All @@ -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

Choose a reason for hiding this comment

The 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

Expand Down