actions-up 1.12.1 → 1.14.0

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.
package/readme.md CHANGED
@@ -16,7 +16,7 @@ Actions Up scans your workflows and composite actions to discover every
16
16
  referenced GitHub Action, then checks for newer releases.
17
17
 
18
18
  Interactively upgrade and pin actions to exact commit SHAs for secure,
19
- reproducible CI and low-friction maintenance.
19
+ reproducible CI, or preserve tag-style references when you need to stay on tags.
20
20
 
21
21
  ## Features
22
22
 
@@ -25,8 +25,8 @@ reproducible CI and low-friction maintenance.
25
25
  `action.yml`/`action.yaml`)
26
26
  - **Reusable Workflows**: Detects and updates reusable workflow calls at the job
27
27
  level
28
- - **SHA pinning**: Updates actions to use commit SHA instead of tags for better
29
- security
28
+ - **Flexible update styles**: Use SHA pinning by default, or preserve tag-style
29
+ references with `--style preserve`
30
30
  - **Batch Updates**: Update multiple actions at once
31
31
  - **Interactive Selection**: Choose which actions to update
32
32
  - **Breaking Changes Detection**: Warns about major version updates
@@ -124,7 +124,7 @@ This will:
124
124
  plus root `action.yml`/`action.yaml`
125
125
  2. Check for available updates
126
126
  3. Show an interactive list to select updates
127
- 4. Apply selected updates with SHA pinning
127
+ 4. Apply selected updates with SHA pinning by default
128
128
 
129
129
  ### Auto-Update Mode
130
130
 
@@ -144,6 +144,17 @@ Check for updates without making any changes:
144
144
  npx actions-up --dry-run
145
145
  ```
146
146
 
147
+ ### JSON Mode
148
+
149
+ Output a machine-readable JSON report instead of the interactive UI:
150
+
151
+ ```bash
152
+ npx actions-up --json
153
+ ```
154
+
155
+ `--json` is report-only: it never writes files, skips the interactive prompt,
156
+ and cannot be combined with `--yes`.
157
+
147
158
  ### Custom Directory
148
159
 
149
160
  By default, Actions Up scans `.github`.
@@ -189,6 +200,24 @@ In `minor` and `patch` modes, Actions Up tries to find the newest compatible tag
189
200
  first (for example, from `@v4` in `minor` mode it will choose the latest
190
201
  `v4.x.y`). If no compatible version exists, that action is skipped.
191
202
 
203
+ ### Update Style
204
+
205
+ By default, Actions Up writes updates as pinned SHAs:
206
+
207
+ ```bash
208
+ npx actions-up --style sha
209
+ ```
210
+
211
+ Use `--style preserve` to keep the current reference style:
212
+
213
+ ```bash
214
+ npx actions-up --style preserve
215
+ ```
216
+
217
+ `preserve` keeps tag references on tags and SHA references on SHAs. For example,
218
+ `actions/checkout@v5` updates to `actions/checkout@v6.0.2`, while a SHA-pinned
219
+ action continues updating to the latest resolved SHA.
220
+
192
221
  ## GitHub Actions Integration
193
222
 
194
223
  ### Automated PR Checks
@@ -235,69 +264,53 @@ jobs:
235
264
  echo "## GitHub Actions Update Check" >> $GITHUB_STEP_SUMMARY
236
265
  echo "" >> $GITHUB_STEP_SUMMARY
237
266
 
238
- # Initialize variables
239
- HAS_UPDATES=false
240
- UPDATE_COUNT=0
241
-
242
- # Run actions-up and capture output
267
+ # Run actions-up and capture machine-readable output
243
268
  echo "Running actions-up to check for updates..."
244
- actions-up --dry-run > actions-up-raw.txt 2>&1
269
+ actions-up --json > actions-up-report.json
245
270
 
246
- # Parse the output to detect updates
247
- if grep -q "→" actions-up-raw.txt; then
248
- HAS_UPDATES=true
249
- # Count the number of updates (lines with arrows)
250
- UPDATE_COUNT=$(grep -c "→" actions-up-raw.txt || echo "0")
251
- fi
271
+ UPDATE_COUNT=$(node -pe "JSON.parse(require('node:fs').readFileSync('actions-up-report.json', 'utf8')).summary.totalUpdates")
252
272
 
253
273
  # Create formatted output
254
- if [ "$HAS_UPDATES" = true ]; then
274
+ if [ "$UPDATE_COUNT" -gt 0 ]; then
255
275
  echo "Found $UPDATE_COUNT GitHub Actions with available updates" >> $GITHUB_STEP_SUMMARY
256
276
  echo "" >> $GITHUB_STEP_SUMMARY
257
277
  echo "<details>" >> $GITHUB_STEP_SUMMARY
258
- echo "<summary>Click to see details</summary>" >> $GITHUB_STEP_SUMMARY
278
+ echo "<summary>Click to see JSON report</summary>" >> $GITHUB_STEP_SUMMARY
259
279
  echo "" >> $GITHUB_STEP_SUMMARY
260
- echo '```' >> $GITHUB_STEP_SUMMARY
261
- cat actions-up-raw.txt >> $GITHUB_STEP_SUMMARY
280
+ echo '```json' >> $GITHUB_STEP_SUMMARY
281
+ cat actions-up-report.json >> $GITHUB_STEP_SUMMARY
262
282
  echo '```' >> $GITHUB_STEP_SUMMARY
263
283
  echo "</details>" >> $GITHUB_STEP_SUMMARY
264
284
 
265
285
  # Create detailed markdown report with better formatting
266
- {
267
- echo "## GitHub Actions Update Report"
268
- echo ""
286
+ node --input-type=module <<'EOF'
287
+ import { readFileSync, writeFileSync } from 'node:fs'
288
+
289
+ let report = JSON.parse(readFileSync('actions-up-report.json', 'utf8'))
290
+ let lines = [
291
+ '## GitHub Actions Update Report',
292
+ '',
293
+ '### Summary',
294
+ `- **Updates available:** ${report.summary.totalUpdates}`,
295
+ '',
296
+ '### Updates',
297
+ '',
298
+ ]
299
+
300
+ for (let update of report.updates) {
301
+ let file = update.action.file ?? 'unknown'
302
+ let currentVersion = update.currentVersion ?? 'unknown'
303
+ let latestVersion = update.latestVersion ?? 'unknown'
304
+ lines.push(
305
+ `- \`${update.action.name}\` in \`${file}\`: \`${currentVersion}\` → \`${latestVersion}\``,
306
+ )
307
+ }
269
308
 
270
- echo "### Summary"
271
- echo "- **Updates available:** $UPDATE_COUNT"
272
- echo ""
309
+ lines.push('')
310
+ lines.push('Run `npx actions-up` locally to review and apply updates.')
273
311
 
274
- # See the raw output above for details.
275
- echo "### How to Update"
276
- echo ""
277
- echo "Choose from several ways to update these actions:"
278
- echo ""
279
- echo "#### Option 1: Automatic Update (Recommended)"
280
- echo '```bash'
281
- echo "# Run this command locally in your repository"
282
- echo "npx actions-up"
283
- echo '```'
284
- echo ""
285
- echo "#### Option 2: Manual Update"
286
- echo "1. Review each update in the table above"
287
- echo "2. For breaking changes, click the Release Notes link to review changes"
288
- echo "3. Edit the workflows and update the version numbers"
289
- echo "4. Test the changes in your CI/CD pipeline"
290
- echo ""
291
- echo "---"
292
- echo ""
293
- echo "<details>"
294
- echo "<summary>Raw actions-up output</summary>"
295
- echo ""
296
- echo '```'
297
- cat actions-up-raw.txt
298
- echo '```'
299
- echo "</details>"
300
- } > actions-up-report.md
312
+ writeFileSync('actions-up-report.md', lines.join('\n'))
313
+ EOF
301
314
 
302
315
  echo "has-updates=true" >> $GITHUB_OUTPUT
303
316
  echo "update-count=$UPDATE_COUNT" >> $GITHUB_OUTPUT
@@ -470,7 +483,7 @@ Or in GitHub Actions:
470
483
  - name: Check for updates
471
484
  env:
472
485
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
473
- run: npx actions-up --dry-run
486
+ run: npx actions-up --json
474
487
  ```
475
488
 
476
489
  ### Skipping Updates
@@ -505,7 +518,8 @@ Ignore comments (file/block/next-line/inline):
505
518
  Interactive CLI for developers who want control over GitHub Actions updates.
506
519
 
507
520
  - **vs. Dependabot/Renovate:** Dependabot and Renovate update via pull requests;
508
- Actions Up is an interactive CLI with explicit SHA pinning.
521
+ Actions Up is an interactive CLI with explicit SHA pinning by default and an
522
+ opt-in preserve mode for tag users.
509
523
  - **vs. pinact:** pinact is a CLI to pin and update Actions and reusable
510
524
  workflows; Actions Up adds interactive selection and major update warnings.
511
525
  - **Zero-config:** `npx actions-up` runs immediately.