@codfish/actions 2.0.1 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +135 -64
  2. package/bin/generate-docs.js +10 -10
  3. package/comment/README.md +9 -9
  4. package/comment/action.yml +3 -3
  5. package/npm-publish-pr/README.md +319 -40
  6. package/npm-publish-pr/action.yml +271 -87
  7. package/package.json +19 -14
  8. package/setup-node-and-install/README.md +77 -34
  9. package/setup-node-and-install/action.yml +36 -3
  10. package/.github/codeql-config.yml +0 -21
  11. package/.github/dependabot.yml +0 -35
  12. package/.github/workflows/claude-code-review.yml +0 -43
  13. package/.github/workflows/claude.yml +0 -38
  14. package/.github/workflows/release.yml +0 -48
  15. package/.github/workflows/security.yml +0 -103
  16. package/.github/workflows/update-docs.yml +0 -38
  17. package/.github/workflows/validate.yml +0 -210
  18. package/.husky/pre-commit +0 -1
  19. package/.nvmrc +0 -1
  20. package/AGENT.md +0 -149
  21. package/CLAUDE.md +0 -3
  22. package/CONTRIBUTING.md +0 -316
  23. package/SECURITY.md +0 -208
  24. package/eslint.config.js +0 -8
  25. package/tests/fixtures/.node-version +0 -1
  26. package/tests/fixtures/.nvmrc +0 -1
  27. package/tests/fixtures/lockfiles/package-lock.json +0 -12
  28. package/tests/fixtures/lockfiles/pnpm-lock.yaml +0 -9
  29. package/tests/fixtures/lockfiles/yarn.lock +0 -7
  30. package/tests/fixtures/package-json/minimal.json +0 -4
  31. package/tests/fixtures/package-json/scoped.json +0 -6
  32. package/tests/fixtures/package-json/valid.json +0 -13
  33. package/tests/integration/comment/basic.bats +0 -95
  34. package/tests/integration/npm-pr-version/basic.bats +0 -438
  35. package/tests/integration/setup-node-and-install/basic.bats +0 -638
  36. package/tests/scripts/test-helpers.sh +0 -113
  37. package/tests/scripts/test-runner.sh +0 -115
@@ -6,7 +6,8 @@ dynamic Node version detection via the `node-version` input, `.node-version`, `.
6
6
  This action provides the following functionality:
7
7
 
8
8
  - Automatically detects package manager (npm, yarn, or pnpm) from lockfiles
9
- - Uses GitHub's official `setup-node` action with optimized caching
9
+ - Uses GitHub's official `setup-node` action (v6) with optimized caching
10
+ - **Upgrades npm to v11** (pinned to `^11.5.1` for OIDC trusted publishing support)
10
11
  - Installs dependencies with appropriate commands based on detected package manager
11
12
  - Supports `.node-version`, `.nvmrc`, and `package.json` `volta.node` for version specification
12
13
  - Intelligent caching of node_modules when lockfiles are present
@@ -17,15 +18,17 @@ This action provides the following functionality:
17
18
 
18
19
  See [action.yml](action.yml).
19
20
 
20
- ```yaml
21
+ ```yml
21
22
  steps:
22
- - uses: actions/checkout@v5
23
+ - uses: actions/checkout@v6
23
24
 
24
- # will install latest Node v18.x
25
- - uses: codfish/actions/setup-node-and-install@v2
25
+ # Will setup node, inferring node version from your codebase & installing your dependencies
26
+ - uses: codfish/actions/setup-node-and-install@v3
27
+
28
+ # Or if you want to be explicit
29
+ - uses: codfish/actions/setup-node-and-install@v3
26
30
  with:
27
- node-version: 18
28
- cache-key-suffix: '-${{ github.head_ref || github.event.release.tag_name }}'
31
+ node-version: 24.4
29
32
 
30
33
  - run: npm test
31
34
  ```
@@ -35,9 +38,6 @@ The `node-version` input is optional. If not supplied, this action will attempt
35
38
  1. `.node-version`, 2) `.nvmrc`, 3) `package.json` `volta.node`. If none are present, `actions/setup-node` runs without
36
39
  an explicit version and will use its default behavior.
37
40
 
38
- The `cache-key-suffix` input is optional. If not supplied, no suffix will be applied to the cache key used to restore
39
- cache in subsequent workflow runs.
40
-
41
41
  The `install-options` input is optional. If not supplied, the npm install commands will execute as defined without any
42
42
  additional options.
43
43
 
@@ -48,11 +48,11 @@ additional options.
48
48
  v18.14.1
49
49
  ```
50
50
 
51
- ```yaml
51
+ ```yml
52
52
  steps:
53
- - uses: actions/checkout@v5
53
+ - uses: actions/checkout@v6
54
54
  # will install Node v18.14.1
55
- - uses: codfish/actions/setup-node-and-install@v2
55
+ - uses: codfish/actions/setup-node-and-install@v3
56
56
  - run: npm test
57
57
  ```
58
58
 
@@ -63,11 +63,11 @@ steps:
63
63
  20.10.0
64
64
  ```
65
65
 
66
- ```yaml
66
+ ```yml
67
67
  steps:
68
- - uses: actions/checkout@v5
68
+ - uses: actions/checkout@v6
69
69
  # will install Node v20.10.0
70
- - uses: codfish/actions/setup-node-and-install@v2
70
+ - uses: codfish/actions/setup-node-and-install@v3
71
71
  - run: npm test
72
72
  ```
73
73
 
@@ -85,11 +85,13 @@ When multiple version specification methods are present, the action uses this pr
85
85
 
86
86
  <!-- start inputs -->
87
87
 
88
- | Input | Description | Required | Default |
89
- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------- |
90
- | `node-version` | Node.js version to install (e.g. "24", "lts/\*"). Precedence: node-version input > .node-version > .nvmrc > package.json volta.node. | No | - |
91
- | `install-options` | Extra command-line options to pass to npm/pnpm/yarn install. | No | - |
92
- | `working-directory` | Directory containing package.json and lockfile. | No | `.` |
88
+ | Input | Description | Required | Default |
89
+ | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
90
+ | `node-version` | Node.js version to install (e.g. "24", "lts/\*"). Precedence: node-version input > .node-version > .nvmrc > package.json volta.node. | No | - |
91
+ | `install-options` | Extra command-line options to pass to npm/pnpm/yarn install. | No | - |
92
+ | `working-directory` | Directory containing package.json and lockfile. | No | `.` |
93
+ | `registry-url` | Optional registry URL to configure for publishing (e.g. "https://registry.npmjs.org/"). Creates .npmrc with NODE_AUTH_TOKEN placeholder. NOT recommended if using semantic-release (it handles auth independently). Only needed for publishing with manual npm publish or other non-semantic-release workflows. | No | - |
94
+ | `upgrade-npm` | Whether to upgrade npm to v11.5.1. This is required for OIDC trusted publishing but can be disabled if you want to shave off some run time and you are still using token-based authentication. | No | `true` |
93
95
 
94
96
  <!-- end inputs -->
95
97
 
@@ -98,35 +100,76 @@ When multiple version specification methods are present, the action uses this pr
98
100
  The action automatically detects your package manager:
99
101
 
100
102
  - **pnpm**: Detected when `pnpm-lock.yaml` exists
103
+ - **yarn**: Detected when `yarn.lock` exists
101
104
  - **npm**: Detected when `package-lock.json` exists or as fallback
102
105
 
106
+ ## npm Version Upgrade
107
+
108
+ This action automatically upgrades npm to **v11** after Node.js setup (pinned to `^11.5.1`). This ensures:
109
+
110
+ - npm 11.5.1+ is available for **OIDC trusted publishing** support (required as of January 2026)
111
+ - Stable, predictable npm behavior across workflows
112
+ - Security fixes and improvements within the v11 release line
113
+ - No unexpected breaking changes from major version updates
114
+
115
+ The upgrade happens transparently and is logged in the workflow output. The version is pinned to prevent unexpected
116
+ breaking changes while still receiving patch and minor updates within v11.
117
+
118
+ ## Registry URL Configuration
119
+
120
+ The `registry-url` input configures npm authentication by creating a `.npmrc` file with a `NODE_AUTH_TOKEN` placeholder.
121
+ **In most cases, you should NOT set this parameter.**
122
+
123
+ ### When NOT to use registry-url (recommended)
124
+
125
+ **Skip this parameter if:**
126
+
127
+ - You're **only installing dependencies** (the primary use case for this action) - authentication is not needed for
128
+ public packages
129
+ - You're using **semantic-release** for publishing - it handles npm authentication independently and `registry-url` can
130
+ cause conflicts
131
+ ([semantic-release docs](https://semantic-release.gitbook.io/semantic-release/recipes/ci-configurations/github-actions#important-avoid-registry-url-in-setup-node))
132
+ - You're using **OIDC trusted publishing** with npm - the upgraded npm v11 handles this automatically
133
+
134
+ ### When to use registry-url
135
+
136
+ **Only set this parameter if:**
137
+
138
+ - You're publishing to npm using **manual `npm publish`** (not semantic-release)
139
+ - You need to authenticate to a **private npm registry**
140
+ - You're using **legacy token-based publishing** and need the `.npmrc` file created
141
+
142
+ ### Example with registry-url
143
+
144
+ ```yml
145
+ - uses: codfish/actions/setup-node-and-install@v3
146
+ with:
147
+ registry-url: 'https://registry.npmjs.org/'
148
+ env:
149
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
150
+
151
+ - run: npm publish
152
+ ```
153
+
103
154
  ## Examples
104
155
 
105
156
  ### With specific Node version
106
157
 
107
- ```yaml
108
- - uses: codfish/actions/setup-node-and-install@v2
158
+ ```yml
159
+ - uses: codfish/actions/setup-node-and-install@v3
109
160
  with:
110
161
  node-version: '18'
111
162
  ```
112
163
 
113
164
  ### With pnpm in subdirectory
114
165
 
115
- ```yaml
116
- - uses: codfish/actions/setup-node-and-install@v2
166
+ ```yml
167
+ - uses: codfish/actions/setup-node-and-install@v3
117
168
  with:
118
169
  working-directory: './frontend'
119
170
  install-options: '--frozen-lockfile'
120
171
  ```
121
172
 
122
- ### With custom cache key
123
-
124
- ```yaml
125
- - uses: codfish/actions/setup-node-and-install@v2
126
- with:
127
- cache-key-suffix: '-${{ github.head_ref }}'
128
- ```
129
-
130
173
  ## Migrating
131
174
 
132
175
  Replace multiple setup steps with this single action:
@@ -137,5 +180,5 @@ Replace multiple setup steps with this single action:
137
180
  - node-version-file: '.nvmrc'
138
181
  - cache: 'npm'
139
182
  - - run: npm ci --prefer-offline --no-audit
140
- + - uses: codfish/actions/setup-node-and-install@v2
183
+ + - uses: codfish/actions/setup-node-and-install@v3
141
184
  ```
@@ -16,11 +16,31 @@ inputs:
16
16
  working-directory:
17
17
  description: Directory containing package.json and lockfile.
18
18
  default: .
19
+ registry-url:
20
+ description:
21
+ 'Optional registry URL to configure for publishing (e.g. "https://registry.npmjs.org/"). Creates .npmrc with
22
+ NODE_AUTH_TOKEN placeholder. NOT recommended if using semantic-release (it handles auth independently). Only
23
+ needed for publishing with manual npm publish or other non-semantic-release workflows.'
24
+ required: false
25
+ upgrade-npm:
26
+ description:
27
+ Whether to upgrade npm to v11.5.1. This is required for OIDC trusted publishing but can be disabled if you want to
28
+ shave off some run time and you are still using token-based authentication.
29
+ default: true
19
30
 
20
31
  outputs:
32
+ node-version:
33
+ description: The installed node version.
34
+ value: ${{ steps.setup-node.outputs.node-version }}
21
35
  cache-hit:
22
36
  description: Whether the dependency cache was hit (true/false).
23
37
  value: "${{ steps.setup-node.outputs.cache-hit == 'true' && 'true' || 'false' }}"
38
+ pnpm-dest:
39
+ description: Expanded path of pnpm dest.
40
+ value: ${{ steps.pnpm-setup.outputs.dest }}
41
+ pnpm-bin-dest:
42
+ description: Location of pnpm and pnpx command.
43
+ value: ${{ steps.pnpm-setup.outputs.bin_dest }}
24
44
 
25
45
  runs:
26
46
  using: composite
@@ -64,6 +84,7 @@ runs:
64
84
  - name: Install pnpm
65
85
  if: steps.detect-package-manager.outputs.package-manager == 'pnpm'
66
86
  uses: pnpm/action-setup@v4
87
+ id: pnpm-setup
67
88
  with:
68
89
  run_install: false
69
90
 
@@ -107,14 +128,26 @@ runs:
107
128
  INPUT_NODE_VERSION: ${{ inputs.node-version }}
108
129
 
109
130
  - name: Setup Node.js
110
- uses: actions/setup-node@v5
131
+ uses: actions/setup-node@v6
111
132
  id: setup-node
112
133
  with:
113
134
  # use detected package manager cache
114
135
  cache: ${{ steps.detect-package-manager.outputs.package-manager }}
115
136
  cache-dependency-path: ${{ inputs.working-directory }}
116
137
  node-version: ${{ steps.detect-node-version.outputs.version }}
117
- registry-url: 'https://registry.npmjs.org'
138
+ registry-url: ${{ inputs.registry-url }}
139
+
140
+ - name: Upgrade npm for OIDC support
141
+ if: inputs.upgrade-npm == 'true'
142
+ shell: bash
143
+ run: |
144
+ echo "📦 Current npm version: $(npm --version)"
145
+ echo "🔄 Upgrading npm to v11 (required for OIDC trusted publishing)..."
146
+ if ! npm install -g npm@^11.5.1; then
147
+ echo "❌ Failed to upgrade npm to v11.5.1. Check network access or permissions."
148
+ exit 1
149
+ fi
150
+ echo "✅ Updated to npm version: $(npm --version)"
118
151
 
119
152
  # Apply `./node_modules` cache only if a lockfile is present and using `npm`
120
153
  # Will remove the need to run install commands twice. Risk reduced by using a very specific cache key.
@@ -123,7 +156,7 @@ runs:
123
156
  if:
124
157
  steps.detect-package-manager.outputs.lockfile-exists == 'true' &&
125
158
  steps.detect-package-manager.outputs.package-manager == 'npm'
126
- uses: actions/cache@v4
159
+ uses: actions/cache@v5
127
160
  id: cache
128
161
  with:
129
162
  path: ${{ inputs.working-directory }}/node_modules
@@ -1,21 +0,0 @@
1
- name: GitHub Actions Security Analysis
2
-
3
- disable-default-queries: false
4
-
5
- queries:
6
- - uses: security-and-quality
7
- - uses: security-experimental
8
-
9
- paths-ignore:
10
- - tests/
11
- - '**/*.test.js'
12
- - '**/*.spec.js'
13
- - '**/node_modules'
14
- - '**/dist'
15
- - '**/build'
16
-
17
- paths:
18
- - '**/*.js'
19
- - '**/*.yml'
20
- - '**/*.yaml'
21
- - '**/*.json'
@@ -1,35 +0,0 @@
1
- version: 2
2
- updates:
3
- # Enable version updates for pnpm dependencies
4
- - package-ecosystem: npm
5
- directory: /
6
- schedule:
7
- interval: weekly
8
- day: monday
9
- time: '09:00'
10
- open-pull-requests-limit: 3
11
- reviewers:
12
- - codfish
13
- assignees:
14
- - codfish
15
- commit-message:
16
- prefix: deps
17
- include: scope
18
- # Use pnpm for package management
19
- versioning-strategy: increase
20
-
21
- # Monitor GitHub Actions for updates
22
- - package-ecosystem: github-actions
23
- directory: /
24
- schedule:
25
- interval: weekly
26
- day: monday
27
- time: '09:00'
28
- open-pull-requests-limit: 3
29
- reviewers:
30
- - codfish
31
- assignees:
32
- - codfish
33
- commit-message:
34
- prefix: ci
35
- include: scope
@@ -1,43 +0,0 @@
1
- name: Claude Code Review
2
-
3
- on: pull_request_target
4
-
5
- jobs:
6
- claude-review:
7
- runs-on: ubuntu-latest
8
-
9
- permissions:
10
- contents: read
11
- pull-requests: write
12
- issues: read
13
- id-token: write
14
-
15
- steps:
16
- - name: Checkout repository
17
- uses: actions/checkout@v5
18
- with:
19
- fetch-depth: 1
20
-
21
- - name: Run Claude Code Review
22
- id: claude-review
23
- uses: anthropics/claude-code-action@beta
24
- with:
25
- anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
26
-
27
- # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
28
- # model: "claude-opus-4-20250514"
29
-
30
- allowed_tools:
31
- 'mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr
32
- view:*)'
33
-
34
- # Direct prompt for automated review (no @claude mention needed)
35
- direct_prompt: |
36
- Please review this pull request and provide feedback on:
37
- - Code quality and best practices
38
- - Potential bugs or issues
39
- - Performance considerations
40
- - Security concerns
41
- - Test coverage
42
-
43
- Be constructive and helpful in your feedback.
@@ -1,38 +0,0 @@
1
- name: Claude Code
2
-
3
- on:
4
- issue_comment:
5
- types: [created]
6
- pull_request_review_comment:
7
- types: [created]
8
- issues:
9
- types: [opened, assigned]
10
- pull_request_review:
11
- types: [submitted]
12
-
13
- jobs:
14
- claude:
15
- if: |
16
- (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
- (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
- (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
- (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
-
21
- runs-on: ubuntu-latest
22
-
23
- permissions:
24
- contents: read
25
- pull-requests: read
26
- issues: read
27
-
28
- steps:
29
- - name: Checkout repository
30
- uses: actions/checkout@v5
31
- with:
32
- fetch-depth: 1
33
-
34
- - name: Run Claude Code
35
- id: claude
36
- uses: anthropics/claude-code-action@beta
37
- with:
38
- anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
@@ -1,48 +0,0 @@
1
- name: Release
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- - alpha
8
- - beta
9
- - canary
10
- - next
11
- - next-major
12
- - '[0-9]+.x'
13
-
14
- permissions:
15
- issues: write
16
- contents: write
17
- pull-requests: write
18
-
19
- jobs:
20
- release:
21
- runs-on: ubuntu-latest
22
-
23
- concurrency:
24
- group: ${{ github.workflow }}-${{ github.ref }}
25
- cancel-in-progress: false
26
-
27
- steps:
28
- - uses: actions/checkout@v5
29
- with:
30
- persist-credentials: false
31
-
32
- - uses: ./setup-node-and-install
33
- with:
34
- node-version: lts/*
35
-
36
- - name: validate before release
37
- run: |
38
- pnpm install
39
- pnpm lint
40
- pnpm test
41
- env:
42
- CI: true
43
-
44
- - name: semantic release
45
- uses: docker://ghcr.io/codfish/semantic-release-action@sha256:5d5447090feb2f9252aac2825ef14e244ecf53528fbe87d585b459adb547b914
46
- env:
47
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,103 +0,0 @@
1
- name: Security
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- pull_request_target:
7
- branches: [main]
8
- schedule:
9
- # Run weekly security scan on Sundays at 2 AM UTC
10
- - cron: '0 2 * * 0'
11
-
12
- permissions:
13
- actions: read
14
- contents: read
15
- security-events: write
16
-
17
- jobs:
18
- codeql:
19
- name: CodeQL Analysis
20
- runs-on: ubuntu-latest
21
-
22
- strategy:
23
- fail-fast: false
24
- matrix:
25
- language: [javascript]
26
-
27
- steps:
28
- - name: Checkout repository
29
- uses: actions/checkout@v5
30
-
31
- - name: Initialize CodeQL
32
- uses: github/codeql-action/init@v3
33
- with:
34
- languages: ${{ matrix.language }}
35
- config-file: ./.github/codeql-config.yml
36
-
37
- - name: Autobuild
38
- uses: github/codeql-action/autobuild@v3
39
-
40
- - name: Perform CodeQL Analysis
41
- uses: github/codeql-action/analyze@v3
42
- with:
43
- category: '/language:${{matrix.language}}'
44
-
45
- dependency-review:
46
- name: Dependency Review
47
- runs-on: ubuntu-latest
48
- if: github.event_name == 'pull_request_target'
49
-
50
- steps:
51
- - name: Checkout repository
52
- uses: actions/checkout@v5
53
-
54
- - name: Dependency Review
55
- uses: actions/dependency-review-action@v4
56
- with:
57
- fail-on-severity: moderate
58
- allow-licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-2-Clause-Views, BSD-3-Clause, ISC, AGPL-3.0
59
-
60
- security-audit:
61
- name: Security Audit
62
- runs-on: ubuntu-latest
63
-
64
- steps:
65
- - name: Checkout repository
66
- uses: actions/checkout@v5
67
-
68
- - name: Setup Node.js and install dependencies
69
- uses: ./setup-node-and-install
70
- with:
71
- node-version: 'lts/*'
72
-
73
- - name: Run pnpm audit
74
- run: |
75
- echo "Running security audit..."
76
- pnpm audit --audit-level=moderate
77
-
78
- - name: Check for known vulnerabilities
79
- run: |
80
- echo "Checking for high/critical vulnerabilities..."
81
- count=$(pnpm audit --audit-level=high --json | jq '.metadata.vulnerabilities.high + .metadata.vulnerabilities.critical')
82
- if [ "$count" -gt 0 ]; then
83
- echo "❌ High or critical vulnerabilities found!"
84
- pnpm audit --audit-level=high
85
- exit 1
86
- else
87
- echo "✅ No high or critical vulnerabilities found"
88
- fi
89
-
90
- secret-scan:
91
- name: Secret Scan
92
- runs-on: ubuntu-latest
93
-
94
- steps:
95
- - name: Checkout repository
96
- uses: actions/checkout@v5
97
- with:
98
- fetch-depth: 0
99
-
100
- - name: Run TruffleHog OSS
101
- uses: trufflesecurity/trufflehog@v3.90.8
102
- with:
103
- extra_args: --debug --only-verified
@@ -1,38 +0,0 @@
1
- name: Update Documentation
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- paths:
7
- - '*/action.yml'
8
- - bin/generate-docs.js
9
-
10
- permissions:
11
- contents: write
12
-
13
- jobs:
14
- update-docs:
15
- name: Auto-update documentation
16
- runs-on: ubuntu-latest
17
-
18
- steps:
19
- - name: Checkout repository
20
- uses: actions/checkout@v5
21
- with:
22
- token: ${{ secrets.GITHUB_TOKEN }}
23
-
24
- # Dogfood our own setup-node-and-install action
25
- - name: Setup Node.js and install dependencies
26
- uses: ./setup-node-and-install
27
- with:
28
- node-version: 'lts/*'
29
-
30
- - name: Generate updated documentation
31
- run: pnpm docs:generate
32
-
33
- - name: Commit and push changes if any
34
- uses: stefanzweifel/git-auto-commit-action@v6
35
- with:
36
- commit_options: --no-verify --signoff
37
- commit_message: 'docs: auto-update documentation with latest action metadata'
38
- file_pattern: 'README.md */README.md'