Add Node.js setup to SLSA generic generator workflow#285
Add Node.js setup to SLSA generic generator workflow#285Apostles1 wants to merge 1 commit intoVisActor:developfrom
Conversation
Added Node.js setup step with configurable options.
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions workflow intended to generate and publish SLSA3 provenance, with an attempted addition of a Node.js setup step.
Changes:
- Introduces a new “SLSA generic generator” workflow to build artifacts and generate provenance.
- Attempts to add Node.js environment setup with configurable options.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: SLSA generic generator | ||
| on: - name: Setup Node.js environment | ||
| uses: actions/setup-node@v6.2.0 | ||
| with: |
There was a problem hiding this comment.
The workflow YAML is invalid: the on: key is immediately followed by a step definition (- name: Setup Node.js environment). Move the Node setup step under jobs.<job>.steps, and restore on: to a proper mapping (e.g., workflow_dispatch: and release:).
| on: - name: Setup Node.js environment | ||
| uses: actions/setup-node@v6.2.0 | ||
| with: | ||
| # Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0. | ||
| node-version: # optional | ||
| # File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions. | ||
| node-version-file: # optional | ||
| # Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default. | ||
| architecture: # optional | ||
| # Set this option if you want the action to check for the latest available version that satisfies the version spec. | ||
| check-latest: # optional | ||
| # Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN. | ||
| registry-url: # optional | ||
| # Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/). | ||
| scope: # optional | ||
| # Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. | ||
| token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }} | ||
| # Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm. | ||
| cache: # optional | ||
| # Set to false to disable automatic caching. By default, caching is enabled when either devEngines.packageManager or the top-level packageManager field in package.json specifies npm as the package manager. | ||
| package-manager-cache: # optional, default is true | ||
| # Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies. | ||
| cache-dependency-path: # optional | ||
| # Used to specify an alternative mirror to download Node.js binaries from | ||
| mirror: # optional | ||
| # The token used as Authorization header when fetching from the mirror | ||
| mirror-token: # optional | ||
|
|
There was a problem hiding this comment.
actions/setup-node is configured with placeholder inputs (e.g., node-version: with no value). The action requires a Node version (or node-version-file), so this will fail at runtime once the step is placed under steps. Provide a concrete default (matching the repo’s Node version) and/or wire these values via workflow_dispatch inputs.
| on: - name: Setup Node.js environment | |
| uses: actions/setup-node@v6.2.0 | |
| with: | |
| # Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0. | |
| node-version: # optional | |
| # File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions. | |
| node-version-file: # optional | |
| # Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default. | |
| architecture: # optional | |
| # Set this option if you want the action to check for the latest available version that satisfies the version spec. | |
| check-latest: # optional | |
| # Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN. | |
| registry-url: # optional | |
| # Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/). | |
| scope: # optional | |
| # Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. | |
| token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }} | |
| # Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm. | |
| cache: # optional | |
| # Set to false to disable automatic caching. By default, caching is enabled when either devEngines.packageManager or the top-level packageManager field in package.json specifies npm as the package manager. | |
| package-manager-cache: # optional, default is true | |
| # Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies. | |
| cache-dependency-path: # optional | |
| # Used to specify an alternative mirror to download Node.js binaries from | |
| mirror: # optional | |
| # The token used as Authorization header when fetching from the mirror | |
| mirror-token: # optional | |
| on: |
| outputs: | ||
| digests: ${{ steps.hash.outputs.digests }} | ||
|
|
There was a problem hiding this comment.
The build job output is wired to steps.hash.outputs.digests, but the hash step writes hashes=... to $GITHUB_OUTPUT. As written, needs.build.outputs.digests will be empty and provenance generation will fail. Align the output key names (either emit digests= or update the references to use hashes).
| with: | ||
| base64-subjects: "${{ needs.build.outputs.digests }}" |
There was a problem hiding this comment.
base64-subjects is set to ${{ needs.build.outputs.digests }}, but the build job currently doesn't actually produce a digests output due to the output key mismatch. Once the build output key is fixed, ensure this input references the corrected output name.
|
Hi @Apostles1, thanks for the contribution! 🙏 I've reviewed this PR and noticed there are a few issues flagged in the review comments that would need to be addressed before we can move forward:
Could you please take a look and fix these issues? Once they are resolved, I'd be happy to consider merging this PR. Thanks again for your time and effort |
Added Node.js setup step with configurable options.
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
🐞 Bugserver case id
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough