actions-up 1.11.0 → 1.12.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 (51) hide show
  1. package/dist/cli/index.d.ts +3 -1
  2. package/dist/cli/index.js +84 -93
  3. package/dist/cli/merge-scan-results.d.ts +8 -0
  4. package/dist/cli/merge-scan-results.js +18 -0
  5. package/dist/cli/normalize-update-mode.d.ts +8 -0
  6. package/dist/cli/normalize-update-mode.js +6 -0
  7. package/dist/cli/print-mode-warning.d.ts +16 -0
  8. package/dist/cli/print-mode-warning.js +11 -0
  9. package/dist/cli/print-skipped-warning.d.ts +14 -0
  10. package/dist/cli/print-skipped-warning.js +10 -0
  11. package/dist/cli/resolve-scan-directories.d.ts +31 -0
  12. package/dist/cli/resolve-scan-directories.js +24 -0
  13. package/dist/core/api/check-updates.d.ts +4 -1
  14. package/dist/core/api/check-updates.js +119 -116
  15. package/dist/core/api/get-all-releases.d.ts +2 -1
  16. package/dist/core/api/get-compatible-update.d.ts +37 -0
  17. package/dist/core/api/get-compatible-update.js +40 -0
  18. package/dist/core/api/get-latest-release.d.ts +3 -3
  19. package/dist/core/ast/utils/extract-uses-from-steps.d.ts +12 -4
  20. package/dist/core/constants.d.ts +3 -1
  21. package/dist/core/fs/find-yaml-files-recursive.js +1 -1
  22. package/dist/core/interactive/prompt-update-selection.d.ts +3 -1
  23. package/dist/core/interactive/prompt-update-selection.js +9 -9
  24. package/dist/core/parsing/parse-action-reference.d.ts +16 -12
  25. package/dist/core/scan-github-actions.d.ts +4 -1
  26. package/dist/core/scan-github-actions.js +67 -68
  27. package/dist/core/scan-recursive.js +12 -14
  28. package/dist/core/versions/find-compatible-tag.d.ts +16 -0
  29. package/dist/core/versions/find-compatible-tag.js +27 -0
  30. package/dist/core/versions/get-update-level.d.ts +3 -1
  31. package/dist/core/versions/is-semver-like.d.ts +9 -0
  32. package/dist/core/versions/is-semver-like.js +4 -0
  33. package/dist/core/versions/normalize-version.d.ts +14 -0
  34. package/dist/core/versions/normalize-version.js +9 -0
  35. package/dist/package.js +1 -1
  36. package/dist/types/action-update.d.ts +30 -10
  37. package/dist/types/composite-action-runs.d.ts +12 -4
  38. package/dist/types/composite-action-step.d.ts +24 -8
  39. package/dist/types/composite-action-structure.d.ts +21 -7
  40. package/dist/types/github-action.d.ts +27 -9
  41. package/dist/types/github-client-context.d.ts +24 -8
  42. package/dist/types/github-client.d.ts +24 -8
  43. package/dist/types/release-info.d.ts +24 -8
  44. package/dist/types/scan-result.d.ts +12 -4
  45. package/dist/types/tag-info.d.ts +15 -5
  46. package/dist/types/update-mode.d.ts +3 -1
  47. package/dist/types/workflow-job.d.ts +27 -9
  48. package/dist/types/workflow-step.d.ts +21 -7
  49. package/dist/types/workflow-structure.d.ts +15 -5
  50. package/package.json +3 -8
  51. package/readme.md +53 -18
@@ -8,35 +8,51 @@ import { TagInfo } from './tag-info';
8
8
  * normalized, serializable data structures.
9
9
  */
10
10
  export interface GitHubClient {
11
- /** Detect whether a reference is a tag or a branch (or unknown). */
11
+ /**
12
+ * Detect whether a reference is a tag or a branch (or unknown).
13
+ */
12
14
  getRefType(
13
15
  owner: string,
14
16
  repo: string,
15
17
  reference: string,
16
18
  ): Promise<'branch' | 'tag' | null>
17
19
 
18
- /** List releases with minimal enrichment. */
20
+ /**
21
+ * List releases with minimal enrichment.
22
+ */
19
23
  getAllReleases(
20
24
  owner: string,
21
25
  repo: string,
22
26
  limit?: number,
23
27
  ): Promise<ReleaseInfo[]>
24
28
 
25
- /** Fetch tag metadata (message/date) and the resolved commit SHA. */
29
+ /**
30
+ * Fetch tag metadata (message/date) and the resolved commit SHA.
31
+ */
26
32
  getTagInfo(owner: string, repo: string, tag: string): Promise<TagInfo | null>
27
33
 
28
- /** Resolve commit SHA for a tag without fetching commit data. */
34
+ /**
35
+ * Resolve commit SHA for a tag without fetching commit data.
36
+ */
29
37
  getTagSha(owner: string, repo: string, tag: string): Promise<string | null>
30
38
 
31
- /** List repository tags (name + commit SHA). */
39
+ /**
40
+ * List repository tags (name + commit SHA).
41
+ */
32
42
  getAllTags(owner: string, repo: string, limit?: number): Promise<TagInfo[]>
33
43
 
34
- /** Fetch the latest release or null when no latest release exists. */
44
+ /**
45
+ * Fetch the latest release or null when no latest release exists.
46
+ */
35
47
  getLatestRelease(owner: string, repo: string): Promise<ReleaseInfo | null>
36
48
 
37
- /** Current rate limit snapshot. */
49
+ /**
50
+ * Current rate limit snapshot.
51
+ */
38
52
  getRateLimitStatus(): { remaining: number; resetAt: Date }
39
53
 
40
- /** True when remaining requests are below a threshold. */
54
+ /**
55
+ * True when remaining requests are below a threshold.
56
+ */
41
57
  shouldWaitForRateLimit(threshold?: number): boolean
42
58
  }
@@ -1,23 +1,39 @@
1
- /** Normalized release information used across the tool. */
1
+ /**
2
+ * Normalized release information used across the tool.
3
+ */
2
4
  export interface ReleaseInfo {
3
- /** Release description (body) or null when absent. */
5
+ /**
6
+ * Release description (body) or null when absent.
7
+ */
4
8
  description: string | null
5
9
 
6
- /** True when the release is marked as prerelease. */
10
+ /**
11
+ * True when the release is marked as prerelease.
12
+ */
7
13
  isPrerelease: boolean
8
14
 
9
- /** Commit SHA associated with the release tag (may be null). */
15
+ /**
16
+ * Commit SHA associated with the release tag when known (may be provisional).
17
+ */
10
18
  sha: string | null
11
19
 
12
- /** Publication date of the release. */
20
+ /**
21
+ * Publication date of the release.
22
+ */
13
23
  publishedAt: Date
14
24
 
15
- /** Tag name (e.g. V1.2.3). */
25
+ /**
26
+ * Tag name (e.g. V1.2.3).
27
+ */
16
28
  version: string
17
29
 
18
- /** Release name or tag name when name is not provided. */
30
+ /**
31
+ * Release name or tag name when name is not provided.
32
+ */
19
33
  name: string
20
34
 
21
- /** HTML URL of the release page. */
35
+ /**
36
+ * HTML URL of the release page.
37
+ */
22
38
  url: string
23
39
  }
@@ -1,12 +1,20 @@
1
1
  import { GitHubAction } from './github-action';
2
- /** Result of scanning a repository for GitHub Actions usage. */
2
+ /**
3
+ * Result of scanning a repository for GitHub Actions usage.
4
+ */
3
5
  export interface ScanResult {
4
- /** Map of workflow files to their used GitHub Actions. */
6
+ /**
7
+ * Map of workflow files to their used GitHub Actions.
8
+ */
5
9
  workflows: Map<string, GitHubAction[]>
6
10
 
7
- /** Map of composite action names to their file paths. */
11
+ /**
12
+ * Map of composite action names to their file paths.
13
+ */
8
14
  compositeActions: Map<string, string>
9
15
 
10
- /** List of all unique GitHub Actions found in the repository. */
16
+ /**
17
+ * List of all unique GitHub Actions found in the repository.
18
+ */
11
19
  actions: GitHubAction[]
12
20
  }
@@ -1,14 +1,24 @@
1
- /** Normalized tag information (message/date) and the resolved commit SHA. */
1
+ /**
2
+ * Normalized tag information (message/date) and the resolved commit SHA.
3
+ */
2
4
  export interface TagInfo {
3
- /** Tag or commit message, null when absent. */
5
+ /**
6
+ * Tag or commit message, null when absent.
7
+ */
4
8
  message: string | null
5
9
 
6
- /** Commit SHA the tag ultimately points to (may be null). */
10
+ /**
11
+ * Commit SHA the tag ultimately points to (may be null).
12
+ */
7
13
  sha: string | null
8
14
 
9
- /** Date associated with the tag (from release, tagger or commit). */
15
+ /**
16
+ * Date associated with the tag (from release, tagger or commit).
17
+ */
10
18
  date: Date | null
11
19
 
12
- /** Tag name (e.g. V1.2.3). */
20
+ /**
21
+ * Tag name (e.g. V1.2.3).
22
+ */
13
23
  tag: string
14
24
  }
@@ -1,2 +1,4 @@
1
- /** Allowed update modes for filtering actions. */
1
+ /**
2
+ * Allowed update modes for filtering actions.
3
+ */
2
4
  export type UpdateMode = 'major' | 'minor' | 'patch'
@@ -1,27 +1,45 @@
1
1
  import { WorkflowStep } from './workflow-step';
2
- /** Represents a job in a GitHub Actions workflow. */
2
+ /**
3
+ * Represents a job in a GitHub Actions workflow.
4
+ */
3
5
  export interface WorkflowJob {
4
- /** Secrets passed to the reusable workflow ('inherit' or specific secrets). */
6
+ /**
7
+ * Secrets passed to the reusable workflow ('inherit' or specific secrets).
8
+ */
5
9
  secrets?: Record<string, unknown> | 'inherit'
6
10
 
7
- /** Input parameters passed to the reusable workflow. */
11
+ /**
12
+ * Input parameters passed to the reusable workflow.
13
+ */
8
14
  with?: Record<string, unknown>
9
15
 
10
- /** Runner environment(s) to execute this job on (e.g., 'ubuntu-latest'). */
16
+ /**
17
+ * Runner environment(s) to execute this job on (e.g., 'ubuntu-latest').
18
+ */
11
19
  'runs-on'?: string[] | string
12
20
 
13
- /** Job IDs that must complete successfully before this job runs. */
21
+ /**
22
+ * Job IDs that must complete successfully before this job runs.
23
+ */
14
24
  needs?: string[] | string
15
25
 
16
- /** Array of steps to execute in this job. */
26
+ /**
27
+ * Array of steps to execute in this job.
28
+ */
17
29
  steps?: WorkflowStep[]
18
30
 
19
- /** Allow additional properties for job configuration. */
31
+ /**
32
+ * Allow additional properties for job configuration.
33
+ */
20
34
  [key: string]: unknown
21
35
 
22
- /** Reusable workflow reference (mutually exclusive with 'steps'). */
36
+ /**
37
+ * Reusable workflow reference (mutually exclusive with 'steps').
38
+ */
23
39
  uses?: string
24
40
 
25
- /** Conditional expression to determine if the job should run. */
41
+ /**
42
+ * Conditional expression to determine if the job should run.
43
+ */
26
44
  if?: string
27
45
  }
@@ -1,20 +1,34 @@
1
- /** Represents a single step in a GitHub Actions workflow job. */
1
+ /**
2
+ * Represents a single step in a GitHub Actions workflow job.
3
+ */
2
4
  export interface WorkflowStep {
3
- /** Input parameters to pass to the action. */
5
+ /**
6
+ * Input parameters to pass to the action.
7
+ */
4
8
  with?: Record<string, unknown>
5
9
 
6
- /** Environment variables to set for this step. */
10
+ /**
11
+ * Environment variables to set for this step.
12
+ */
7
13
  env?: Record<string, unknown>
8
14
 
9
- /** Allow additional properties for step configuration. */
15
+ /**
16
+ * Allow additional properties for step configuration.
17
+ */
10
18
  [key: string]: unknown
11
19
 
12
- /** Action to use for this step (e.g., 'actions/checkout@v4'). */
20
+ /**
21
+ * Action to use for this step (e.g., 'actions/checkout@v4').
22
+ */
13
23
  uses?: string
14
24
 
15
- /** Display name for this step. */
25
+ /**
26
+ * Display name for this step.
27
+ */
16
28
  name?: string
17
29
 
18
- /** Shell command to run for this step. */
30
+ /**
31
+ * Shell command to run for this step.
32
+ */
19
33
  run?: string
20
34
  }
@@ -1,15 +1,25 @@
1
1
  import { WorkflowJob } from './workflow-job';
2
- /** Represents the root structure of a GitHub Actions workflow file. */
2
+ /**
3
+ * Represents the root structure of a GitHub Actions workflow file.
4
+ */
3
5
  export interface WorkflowStructure {
4
- /** Map of job IDs to job configurations. */
6
+ /**
7
+ * Map of job IDs to job configurations.
8
+ */
5
9
  jobs?: Record<string, WorkflowJob>
6
10
 
7
- /** Allow additional properties for workflow configuration. */
11
+ /**
12
+ * Allow additional properties for workflow configuration.
13
+ */
8
14
  [key: string]: unknown
9
15
 
10
- /** Display name for the workflow. */
16
+ /**
17
+ * Display name for the workflow.
18
+ */
11
19
  name?: string
12
20
 
13
- /** Events that trigger the workflow (push, pull_request, etc.). */
21
+ /**
22
+ * Events that trigger the workflow (push, pull_request, etc.).
23
+ */
14
24
  on?: unknown
15
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "actions-up",
3
- "version": "1.11.0",
3
+ "version": "1.12.1",
4
4
  "description": "Interactive CLI tool to update GitHub Actions to latest versions with SHA pinning",
5
5
  "keywords": [
6
6
  "github-actions",
@@ -36,19 +36,14 @@
36
36
  "./dist"
37
37
  ],
38
38
  "dependencies": {
39
- "cac": "^6.7.14",
39
+ "cac": "^7.0.0",
40
40
  "enquirer": "^2.4.1",
41
41
  "nanospinner": "^1.2.2",
42
42
  "picocolors": "^1.1.1",
43
43
  "semver": "^7.7.4",
44
- "yaml": "^2.8.2"
44
+ "yaml": "^2.8.3"
45
45
  },
46
46
  "engines": {
47
47
  "node": "^18.0.0 || >=20.0.0"
48
- },
49
- "pnpm": {
50
- "overrides": {
51
- "vite": "npm:rolldown-vite@latest"
52
- }
53
48
  }
54
49
  }
package/readme.md CHANGED
@@ -12,15 +12,21 @@
12
12
  [![Code Coverage](https://img.shields.io/codecov/c/github/azat-io/actions-up.svg?color=fff&labelColor=4493f8)](https://codecov.io/gh/azat-io/actions-up)
13
13
  [![GitHub License](https://img.shields.io/badge/license-MIT-232428.svg?color=fff&labelColor=4493f8)](https://github.com/azat-io/actions-up/blob/main/license.md)
14
14
 
15
- Actions Up scans your workflows and composite actions to discover every referenced GitHub Action, then checks for newer releases.
15
+ Actions Up scans your workflows and composite actions to discover every
16
+ referenced GitHub Action, then checks for newer releases.
16
17
 
17
- Interactively upgrade and pin actions to exact commit SHAs for secure, reproducible CI and low-friction maintenance.
18
+ Interactively upgrade and pin actions to exact commit SHAs for secure,
19
+ reproducible CI and low-friction maintenance.
18
20
 
19
21
  ## Features
20
22
 
21
- - **Auto-discovery**: Scans all workflows (`.github/workflows/*.yml`) and composite actions (`.github/actions/*/action.yml` and root `action.yml`/`action.yaml`)
22
- - **Reusable Workflows**: Detects and updates reusable workflow calls at the job level
23
- - **SHA pinning**: Updates actions to use commit SHA instead of tags for better security
23
+ - **Auto-discovery**: Scans all workflows (`.github/workflows/*.yml`) and
24
+ composite actions (`.github/actions/*/action.yml` and root
25
+ `action.yml`/`action.yaml`)
26
+ - **Reusable Workflows**: Detects and updates reusable workflow calls at the job
27
+ level
28
+ - **SHA pinning**: Updates actions to use commit SHA instead of tags for better
29
+ security
24
30
  - **Batch Updates**: Update multiple actions at once
25
31
  - **Interactive Selection**: Choose which actions to update
26
32
  - **Breaking Changes Detection**: Warns about major version updates
@@ -49,7 +55,9 @@ Interactively upgrade and pin actions to exact commit SHAs for secure, reproduci
49
55
 
50
56
  ## Why
51
57
 
52
- Keeping GitHub Actions updated is critical and time-consuming. Actions Up scans all workflows, highlights available updates, and can pin actions to SHAs for reproducibility.
58
+ Keeping GitHub Actions updated is critical and time-consuming. Actions Up scans
59
+ all workflows, highlights available updates, and can pin actions to SHAs for
60
+ reproducibility.
53
61
 
54
62
  | Without Actions Up | With Actions Up |
55
63
  | :----------------------------- | :------------------------------- |
@@ -59,7 +67,10 @@ Keeping GitHub Actions updated is critical and time-consuming. Actions Up scans
59
67
 
60
68
  ### Security Motivation
61
69
 
62
- GitHub Actions run arbitrary code in your CI. If a job has secrets available, any action used in that job can read the environment and exfiltrate those secrets. A compromised action or a mutable version tag is a direct path to leakage.
70
+ GitHub Actions run arbitrary code in your CI. If a job has secrets available,
71
+ any action used in that job can read the environment and exfiltrate those
72
+ secrets. A compromised action or a mutable version tag is a direct path to
73
+ leakage.
63
74
 
64
75
  Actions Up reduces risk by:
65
76
 
@@ -67,7 +78,9 @@ Actions Up reduces risk by:
67
78
  - Making outdated actions visible and showing exactly what runs in CI
68
79
  - Warning about major updates so you can review changes before applying them
69
80
 
70
- Note: secrets are available on `push`, `workflow_dispatch`, `schedule`, and `pull_request_target` triggers (and on fork PRs if explicitly enabled). Always scope workflow permissions to the minimum required.
81
+ Note: secrets are available on `push`, `workflow_dispatch`, `schedule`, and
82
+ `pull_request_target` triggers (and on fork PRs if explicitly enabled). Always
83
+ scope workflow permissions to the minimum required.
71
84
 
72
85
  ## Installation
73
86
 
@@ -107,7 +120,8 @@ npx actions-up
107
120
 
108
121
  This will:
109
122
 
110
- 1. Scan all `.github/workflows/*.yml` and `.github/actions/*/action.yml` files, plus root `action.yml`/`action.yaml`
123
+ 1. Scan all `.github/workflows/*.yml` and `.github/actions/*/action.yml` files,
124
+ plus root `action.yml`/`action.yaml`
111
125
  2. Check for available updates
112
126
  3. Show an interactive list to select updates
113
127
  4. Apply selected updates with SHA pinning
@@ -134,7 +148,8 @@ npx actions-up --dry-run
134
148
 
135
149
  By default, Actions Up scans `.github`.
136
150
 
137
- Use `--dir` to choose another directory, and pass it multiple times to scan several directories:
151
+ Use `--dir` to choose another directory, and pass it multiple times to scan
152
+ several directories:
138
153
 
139
154
  ```bash
140
155
  npx actions-up --dir .gitea
@@ -143,15 +158,23 @@ npx actions-up --dir .github --dir ./other/.github
143
158
 
144
159
  ### Recursive Scanning
145
160
 
146
- Use `--recursive` (`-r`) to scan YAML workflow/composite-action files recursively in the selected directories:
161
+ Use `--recursive` (`-r`) to scan YAML workflow/composite-action files
162
+ recursively in the selected directories:
147
163
 
148
164
  ```bash
165
+ npx actions-up -r
149
166
  npx actions-up --dir ./gh-repo-defaults -r
150
167
  ```
151
168
 
169
+ When `--recursive` is used without `--dir`, Actions Up scans from the current
170
+ directory (`.`).
171
+
152
172
  ### Branch References
153
173
 
154
- By default, actions pinned to branch refs (e.g., `@main`, `@release/v1`) are skipped to avoid changing intentionally floating references. Skipped entries are listed in the output. To include them in update checks, pass `--include-branches`.
174
+ By default, actions pinned to branch refs (e.g., `@main`, `@release/v1`) are
175
+ skipped to avoid changing intentionally floating references. Skipped entries are
176
+ listed in the output. To include them in update checks, pass
177
+ `--include-branches`.
155
178
 
156
179
  ### Update Mode
157
180
 
@@ -162,11 +185,17 @@ npx actions-up --mode minor
162
185
  npx actions-up --mode patch
163
186
  ```
164
187
 
188
+ In `minor` and `patch` modes, Actions Up tries to find the newest compatible tag
189
+ first (for example, from `@v4` in `minor` mode it will choose the latest
190
+ `v4.x.y`). If no compatible version exists, that action is skipped.
191
+
165
192
  ## GitHub Actions Integration
166
193
 
167
194
  ### Automated PR Checks
168
195
 
169
- You can integrate Actions Up into your CI/CD pipeline to automatically check for outdated actions on every pull request. This helps maintain security and ensures your team stays aware of available updates.
196
+ You can integrate Actions Up into your CI/CD pipeline to automatically check for
197
+ outdated actions on every pull request. This helps maintain security and ensures
198
+ your team stays aware of available updates.
170
199
 
171
200
  <details>
172
201
  <summary>Create <code>.github/workflows/check-actions-updates.yml</code>.</summary>
@@ -288,7 +317,9 @@ jobs:
288
317
  fi
289
318
 
290
319
  - name: Comment PR with updates
291
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
320
+ if:
321
+ github.event_name == 'pull_request' &&
322
+ github.event.pull_request.head.repo.full_name == github.repository
292
323
  uses: actions/github-script@v7
293
324
  with:
294
325
  script: |
@@ -426,7 +457,8 @@ jobs:
426
457
 
427
458
  ### GitHub Token
428
459
 
429
- Use `GITHUB_TOKEN` (or a PAT) to raise API rate limits from 60 to 5000 requests/hour.
460
+ Use `GITHUB_TOKEN` (or a PAT) to raise API rate limits from 60 to 5000
461
+ requests/hour.
430
462
 
431
463
  ```bash
432
464
  GITHUB_TOKEN=your_token_here npx actions-up
@@ -472,14 +504,17 @@ Ignore comments (file/block/next-line/inline):
472
504
 
473
505
  Interactive CLI for developers who want control over GitHub Actions updates.
474
506
 
475
- - **vs. Dependabot/Renovate:** Dependabot and Renovate update via pull requests; Actions Up is an interactive CLI with explicit SHA pinning.
476
- - **vs. pinact:** pinact is a CLI to pin and update Actions and reusable workflows; Actions Up adds interactive selection and major update warnings.
507
+ - **vs. Dependabot/Renovate:** Dependabot and Renovate update via pull requests;
508
+ Actions Up is an interactive CLI with explicit SHA pinning.
509
+ - **vs. pinact:** pinact is a CLI to pin and update Actions and reusable
510
+ workflows; Actions Up adds interactive selection and major update warnings.
477
511
  - **Zero-config:** `npx actions-up` runs immediately.
478
512
  - **Breaking change warnings:** Major updates are flagged before applying.
479
513
 
480
514
  ## Contributing
481
515
 
482
- See [Contributing Guide](https://github.com/azat-io/actions-up/blob/main/contributing.md).
516
+ See
517
+ [Contributing Guide](https://github.com/azat-io/actions-up/blob/main/contributing.md).
483
518
 
484
519
  ## License
485
520