actions-up 0.0.1 → 0.1.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.
Files changed (77) hide show
  1. package/bin/actions-up.js +5 -0
  2. package/dist/cli/index.d.ts +2 -0
  3. package/dist/cli/index.js +67 -0
  4. package/dist/core/api/check-updates.d.ts +10 -0
  5. package/dist/core/api/check-updates.js +139 -0
  6. package/dist/core/api/client.d.ts +79 -0
  7. package/dist/core/api/client.js +187 -0
  8. package/dist/core/ast/guards/has-range.d.ts +10 -0
  9. package/dist/core/ast/guards/has-range.js +4 -0
  10. package/dist/core/ast/guards/is-node.d.ts +8 -0
  11. package/dist/core/ast/guards/is-node.js +4 -0
  12. package/dist/core/ast/guards/is-pair.d.ts +8 -0
  13. package/dist/core/ast/guards/is-pair.js +4 -0
  14. package/dist/core/ast/guards/is-scalar.d.ts +8 -0
  15. package/dist/core/ast/guards/is-scalar.js +4 -0
  16. package/dist/core/ast/guards/is-yaml-map.d.ts +8 -0
  17. package/dist/core/ast/guards/is-yaml-map.js +4 -0
  18. package/dist/core/ast/guards/is-yaml-sequence.d.ts +8 -0
  19. package/dist/core/ast/guards/is-yaml-sequence.js +4 -0
  20. package/dist/core/ast/scanners/scan-composite-action-ast.d.ts +14 -0
  21. package/dist/core/ast/scanners/scan-composite-action-ast.js +18 -0
  22. package/dist/core/ast/scanners/scan-workflow-ast.d.ts +14 -0
  23. package/dist/core/ast/scanners/scan-workflow-ast.js +23 -0
  24. package/dist/core/ast/update/apply-updates.d.ts +7 -0
  25. package/dist/core/ast/update/apply-updates.js +25 -0
  26. package/dist/core/ast/utils/extract-uses-from-steps.d.ts +13 -0
  27. package/dist/core/ast/utils/extract-uses-from-steps.js +24 -0
  28. package/dist/core/ast/utils/find-map-pair.d.ts +12 -0
  29. package/dist/core/ast/utils/find-map-pair.js +10 -0
  30. package/dist/core/ast/utils/get-line-number.d.ts +10 -0
  31. package/dist/core/ast/utils/get-line-number.js +9 -0
  32. package/dist/core/constants.d.ts +4 -0
  33. package/dist/core/constants.js +4 -0
  34. package/dist/core/fs/is-yaml-file.d.ts +7 -0
  35. package/dist/core/fs/is-yaml-file.js +4 -0
  36. package/dist/core/fs/read-yaml-document.d.ts +11 -0
  37. package/dist/core/fs/read-yaml-document.js +11 -0
  38. package/dist/core/index.d.ts +3 -0
  39. package/dist/core/index.js +4 -0
  40. package/dist/core/interactive/format-version.d.ts +7 -0
  41. package/dist/core/interactive/format-version.js +5 -0
  42. package/dist/core/interactive/pad-string.d.ts +8 -0
  43. package/dist/core/interactive/pad-string.js +9 -0
  44. package/dist/core/interactive/prompt-update-selection.d.ts +2 -0
  45. package/dist/core/interactive/prompt-update-selection.js +203 -0
  46. package/dist/core/interactive/strip-ansi.d.ts +7 -0
  47. package/dist/core/interactive/strip-ansi.js +21 -0
  48. package/dist/core/parsing/parse-action-reference.d.ts +30 -0
  49. package/dist/core/parsing/parse-action-reference.js +34 -0
  50. package/dist/core/scan-action-file.d.ts +10 -0
  51. package/dist/core/scan-action-file.js +7 -0
  52. package/dist/core/scan-github-actions.d.ts +17 -0
  53. package/dist/core/scan-github-actions.js +88 -0
  54. package/dist/core/scan-workflow-file.d.ts +9 -0
  55. package/dist/core/scan-workflow-file.js +7 -0
  56. package/dist/core/schema/composite/is-composite-action-runs.d.ts +8 -0
  57. package/dist/core/schema/composite/is-composite-action-runs.js +6 -0
  58. package/dist/core/schema/composite/is-composite-action-step.d.ts +8 -0
  59. package/dist/core/schema/composite/is-composite-action-structure.d.ts +9 -0
  60. package/dist/core/schema/composite/is-composite-action-structure.js +6 -0
  61. package/dist/core/schema/workflow/is-workflow-job.d.ts +8 -0
  62. package/dist/core/schema/workflow/is-workflow-step.d.ts +8 -0
  63. package/dist/core/schema/workflow/is-workflow-structure.d.ts +8 -0
  64. package/dist/core/schema/workflow/is-workflow-structure.js +6 -0
  65. package/dist/package.js +2 -0
  66. package/dist/types/action-update.d.ts +21 -0
  67. package/dist/types/composite-action-runs.d.ts +12 -0
  68. package/dist/types/composite-action-step.d.ts +23 -0
  69. package/dist/types/composite-action-structure.d.ts +21 -0
  70. package/dist/types/github-action.d.ts +23 -0
  71. package/dist/types/scan-result.d.ts +12 -0
  72. package/dist/types/workflow-job.d.ts +18 -0
  73. package/dist/types/workflow-step.d.ts +20 -0
  74. package/dist/types/workflow-structure.d.ts +15 -0
  75. package/license.md +20 -0
  76. package/package.json +52 -1
  77. package/readme.md +127 -0
@@ -0,0 +1,8 @@
1
+ import { CompositeActionRuns } from '../../../types/composite-action-runs';
2
+ /**
3
+ * Type guard to check if a value conforms to the CompositeActionRuns interface.
4
+ *
5
+ * @param value - The value to check.
6
+ * @returns True if the value is a valid runs configuration.
7
+ */
8
+ export declare function isCompositeActionRuns(value: unknown): value is CompositeActionRuns;
@@ -0,0 +1,6 @@
1
+ function isCompositeActionRuns(value) {
2
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
3
+ let object = value;
4
+ return "using" in object;
5
+ }
6
+ export { isCompositeActionRuns };
@@ -0,0 +1,8 @@
1
+ import { CompositeActionStep } from '../../../types/composite-action-step';
2
+ /**
3
+ * Type guard to check if a value conforms to the CompositeActionStep interface.
4
+ *
5
+ * @param value - The value to check.
6
+ * @returns True if the value is a valid composite action step.
7
+ */
8
+ export declare function isCompositeActionStep(value: unknown): value is CompositeActionStep;
@@ -0,0 +1,9 @@
1
+ import { CompositeActionStructure } from '../../../types/composite-action-structure';
2
+ /**
3
+ * Type guard to check if a value conforms to the CompositeActionStructure
4
+ * interface.
5
+ *
6
+ * @param value - The value to check.
7
+ * @returns True if the value is a valid composite action structure.
8
+ */
9
+ export declare function isCompositeActionStructure(value: unknown): value is CompositeActionStructure;
@@ -0,0 +1,6 @@
1
+ function isCompositeActionStructure(value) {
2
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
3
+ let object = value;
4
+ return "name" in object || "description" in object || "runs" in object;
5
+ }
6
+ export { isCompositeActionStructure };
@@ -0,0 +1,8 @@
1
+ import { WorkflowJob } from '../../../types/workflow-job';
2
+ /**
3
+ * Type guard to check if a value conforms to the WorkflowJob interface.
4
+ *
5
+ * @param value - The value to check.
6
+ * @returns True if the value is a valid workflow job.
7
+ */
8
+ export declare function isWorkflowJob(value: unknown): value is WorkflowJob;
@@ -0,0 +1,8 @@
1
+ import { WorkflowStep } from '../../../types/workflow-step';
2
+ /**
3
+ * Type guard to check if a value conforms to the WorkflowStep interface.
4
+ *
5
+ * @param value - The value to check.
6
+ * @returns True if the value is a valid workflow step.
7
+ */
8
+ export declare function isWorkflowStep(value: unknown): value is WorkflowStep;
@@ -0,0 +1,8 @@
1
+ import { WorkflowStructure } from '../../../types/workflow-structure';
2
+ /**
3
+ * Type guard to check if a value conforms to the WorkflowStructure interface.
4
+ *
5
+ * @param value - The value to check.
6
+ * @returns True if the value is a valid workflow structure.
7
+ */
8
+ export declare function isWorkflowStructure(value: unknown): value is WorkflowStructure;
@@ -0,0 +1,6 @@
1
+ function isWorkflowStructure(value) {
2
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
3
+ let object = value;
4
+ return "on" in object || "name" in object || "jobs" in object;
5
+ }
6
+ export { isWorkflowStructure };
@@ -0,0 +1,2 @@
1
+ const version = "0.1.0";
2
+ export { version };
@@ -0,0 +1,21 @@
1
+ import { GitHubAction } from './github-action';
2
+ /** Update information for a GitHub Action. */
3
+ export interface ActionUpdate {
4
+ /** Current version string. */
5
+ currentVersion: string | null
6
+
7
+ /** Latest available version. */
8
+ latestVersion: string | null
9
+
10
+ /** SHA hash of the latest version. */
11
+ latestSha: string | null
12
+
13
+ /** The original action from scanning. */
14
+ action: GitHubAction
15
+
16
+ /** Whether this is a major version change. */
17
+ isBreaking: boolean
18
+
19
+ /** Whether an update is available. */
20
+ hasUpdate: boolean
21
+ }
@@ -0,0 +1,12 @@
1
+ import { CompositeActionStep } from './composite-action-step';
2
+ /** Represents the runs configuration for a composite action. */
3
+ export interface CompositeActionRuns {
4
+ /** Array of steps to execute. */
5
+ steps?: CompositeActionStep[]
6
+
7
+ /** Allow additional properties. */
8
+ [key: string]: unknown
9
+
10
+ /** Must be 'composite' for composite actions. */
11
+ using?: string
12
+ }
@@ -0,0 +1,23 @@
1
+ /** Represents a step in a composite GitHub Action. */
2
+ export interface CompositeActionStep {
3
+ /** Environment variables for this step. */
4
+ env?: Record<string, unknown>
5
+
6
+ /** Working directory for the step. */
7
+ 'working-directory'?: string
8
+
9
+ /** Allow additional properties. */
10
+ [key: string]: unknown
11
+
12
+ /** Shell to use for the run command. */
13
+ shell?: string
14
+
15
+ /** Action to use for this step. */
16
+ uses?: string
17
+
18
+ /** Display name for this step. */
19
+ name?: string
20
+
21
+ /** Shell command to run for this step. */
22
+ run?: string
23
+ }
@@ -0,0 +1,21 @@
1
+ import { CompositeActionRuns } from './composite-action-runs';
2
+ /** Represents the structure of a composite GitHub Action file. */
3
+ export interface CompositeActionStructure {
4
+ /** Output values from the action. */
5
+ outputs?: Record<string, unknown>
6
+
7
+ /** Input parameters for the action. */
8
+ inputs?: Record<string, unknown>
9
+
10
+ /** Runs configuration for composite actions. */
11
+ runs?: CompositeActionRuns
12
+
13
+ /** Allow additional properties. */
14
+ [key: string]: unknown
15
+
16
+ /** Description of what the action does. */
17
+ description?: string
18
+
19
+ /** Display name of the action. */
20
+ name?: string
21
+ }
@@ -0,0 +1,23 @@
1
+ /** Represents a GitHub Action used in workflows or composite actions. */
2
+ export interface GitHubAction {
3
+ /** Type of the GitHub Action. */
4
+ type: 'composite' | 'external' | 'docker' | 'local'
5
+
6
+ /** Version or tag of the action (e.g., 'v1', 'main', commit SHA). */
7
+ version?: string | null
8
+
9
+ /** Line number where the action is used in the file. */
10
+ line?: number
11
+
12
+ /** Path to the file where this action is used. */
13
+ file?: string
14
+
15
+ /** Original `uses` string from workflow, if available. */
16
+ uses?: string
17
+
18
+ /** Full name of the action (e.g., 'actions/checkout'). */
19
+ name: string
20
+
21
+ /** Original `ref` string from workflow, if available. */
22
+ ref?: string
23
+ }
@@ -0,0 +1,12 @@
1
+ import { GitHubAction } from './github-action';
2
+ /** Result of scanning a repository for GitHub Actions usage. */
3
+ export interface ScanResult {
4
+ /** Map of workflow files to their used GitHub Actions. */
5
+ workflows: Map<string, GitHubAction[]>
6
+
7
+ /** Map of composite action names to their file paths. */
8
+ compositeActions: Map<string, string>
9
+
10
+ /** List of all unique GitHub Actions found in the repository. */
11
+ actions: GitHubAction[]
12
+ }
@@ -0,0 +1,18 @@
1
+ import { WorkflowStep } from './workflow-step';
2
+ /** Represents a job in a GitHub Actions workflow. */
3
+ export interface WorkflowJob {
4
+ /** Runner environment(s) to execute this job on (e.g., 'ubuntu-latest'). */
5
+ 'runs-on'?: string[] | string
6
+
7
+ /** Job IDs that must complete successfully before this job runs. */
8
+ needs?: string[] | string
9
+
10
+ /** Array of steps to execute in this job. */
11
+ steps?: WorkflowStep[]
12
+
13
+ /** Allow additional properties for job configuration. */
14
+ [key: string]: unknown
15
+
16
+ /** Conditional expression to determine if the job should run. */
17
+ if?: string
18
+ }
@@ -0,0 +1,20 @@
1
+ /** Represents a single step in a GitHub Actions workflow job. */
2
+ export interface WorkflowStep {
3
+ /** Input parameters to pass to the action. */
4
+ with?: Record<string, unknown>
5
+
6
+ /** Environment variables to set for this step. */
7
+ env?: Record<string, unknown>
8
+
9
+ /** Allow additional properties for step configuration. */
10
+ [key: string]: unknown
11
+
12
+ /** Action to use for this step (e.g., 'actions/checkout@v4'). */
13
+ uses?: string
14
+
15
+ /** Display name for this step. */
16
+ name?: string
17
+
18
+ /** Shell command to run for this step. */
19
+ run?: string
20
+ }
@@ -0,0 +1,15 @@
1
+ import { WorkflowJob } from './workflow-job';
2
+ /** Represents the root structure of a GitHub Actions workflow file. */
3
+ export interface WorkflowStructure {
4
+ /** Map of job IDs to job configurations. */
5
+ jobs?: Record<string, WorkflowJob>
6
+
7
+ /** Allow additional properties for workflow configuration. */
8
+ [key: string]: unknown
9
+
10
+ /** Display name for the workflow. */
11
+ name?: string
12
+
13
+ /** Events that trigger the workflow (push, pull_request, etc.). */
14
+ on?: unknown
15
+ }
package/license.md ADDED
@@ -0,0 +1,20 @@
1
+ # The MIT License (MIT)
2
+
3
+ Copyright 2025 Azat S. <to@azat.io>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json CHANGED
@@ -1,4 +1,55 @@
1
1
  {
2
2
  "name": "actions-up",
3
- "version": "0.0.1"
3
+ "version": "0.1.0",
4
+ "description": "Interactive CLI tool to update GitHub Actions to latest versions with SHA pinning",
5
+ "keywords": [
6
+ "github-actions",
7
+ "actions",
8
+ "updater",
9
+ "cli",
10
+ "workflow",
11
+ "ci-cd",
12
+ "security",
13
+ "sha",
14
+ "dependencies",
15
+ "update"
16
+ ],
17
+ "homepage": "https://github.com/azat-io/actions-up",
18
+ "repository": "azat-io/actions-up",
19
+ "license": "MIT",
20
+ "author": "Azat S. <to@azat.io>",
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/core/index.d.ts",
25
+ "default": "./dist/core/index.js"
26
+ },
27
+ "./package.json": "./package.json"
28
+ },
29
+ "main": "./dist/core/index.js",
30
+ "types": "./dist/core/index.d.ts",
31
+ "bin": {
32
+ "actions-up": "./bin/actions-up.js"
33
+ },
34
+ "files": [
35
+ "./bin",
36
+ "./dist"
37
+ ],
38
+ "dependencies": {
39
+ "@octokit/graphql": "^9.0.1",
40
+ "cac": "^6.7.14",
41
+ "enquirer": "^2.4.1",
42
+ "nanospinner": "^1.2.2",
43
+ "picocolors": "^1.1.1",
44
+ "semver": "^7.7.2",
45
+ "yaml": "^2.8.1"
46
+ },
47
+ "engines": {
48
+ "node": "^18.0.0 || >=20.0.0"
49
+ },
50
+ "pnpm": {
51
+ "overrides": {
52
+ "vite": "npm:rolldown-vite@latest"
53
+ }
54
+ }
4
55
  }
package/readme.md ADDED
@@ -0,0 +1,127 @@
1
+ # Actions Up!
2
+
3
+ <img
4
+ src="https://raw.githubusercontent.com/azat-io/actions-up/main/assets/logo.svg"
5
+ alt="Actions Up! logo"
6
+ width="160"
7
+ height="160"
8
+ align="right"
9
+ />
10
+
11
+ [![Version](https://img.shields.io/npm/v/actions-up.svg?color=fff&labelColor=4493f8)](https://npmjs.com/package/actions-up)
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
+ [![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
+
15
+ Actions Up scans your workflows and composite actions to discover every referenced GitHub Action, then checks for newer releases.
16
+
17
+ Interactively upgrade and pin actions to exact commit SHAs for secure, reproducible CI and low‑friction maintenance.
18
+
19
+ ## Features
20
+
21
+ - **Auto-discovery** - Scans all workflows (`.github/workflows/*.yml`) and composite actions (`.github/actions/*/action.yml`)
22
+ - **SHA Pinning** - Updates actions to use commit SHA instead of tags for better security
23
+ - **Batch Updates** - Update multiple actions at once
24
+ - **Interactive Selection** - Choose which actions to update
25
+ - **Breaking Changes Detection** - Warns about major version updates
26
+ - **Fast & Efficient** - Parallel processing with optimized API calls
27
+
28
+ ###
29
+
30
+ <br>
31
+
32
+ <picture>
33
+ <source
34
+ srcset="https://raw.githubusercontent.com/azat-io/actions-up/main/assets/example-light.webp"
35
+ media="(prefers-color-scheme: light)"
36
+ />
37
+ <source
38
+ srcset="https://raw.githubusercontent.com/azat-io/actions-up/main/assets/example-dark.webp"
39
+ media="(prefers-color-scheme: dark)"
40
+ />
41
+ <img
42
+ src="https://raw.githubusercontent.com/azat-io/actions-up/main/assets/example-light.webp"
43
+ alt="Token Limit CLI Example"
44
+ width="600"
45
+ />
46
+ </picture>
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ npm install -g actions-up
52
+ ```
53
+
54
+ Or use directly with npx:
55
+
56
+ ```bash
57
+ npx actions-up
58
+ ```
59
+
60
+ ## Usage
61
+
62
+ ### Interactive Mode (Default)
63
+
64
+ Run in your repository root:
65
+
66
+ ```bash
67
+ actions-up
68
+ ```
69
+
70
+ This will:
71
+
72
+ 1. Scan all `.github/workflows/*.yml` and `.github/actions/*/action.yml` files
73
+ 2. Check for available updates
74
+ 3. Show an interactive list to select updates
75
+ 4. Apply selected updates with SHA pinning
76
+
77
+ ### Auto-Update Mode
78
+
79
+ Skip all prompts and update everything:
80
+
81
+ ```bash
82
+ actions-up --yes
83
+ # or
84
+ actions-up -y
85
+ ```
86
+
87
+ ### With GitHub Token
88
+
89
+ To avoid rate limits [create a GitHub personal access token](https://github.com/settings/tokens/new?scopes=public_repo&description=actions-up) and set it as an environment variable:
90
+
91
+ ```bash
92
+ GITHUB_TOKEN=ghp_xxxx actions-up
93
+ ```
94
+
95
+ ## Example
96
+
97
+ ```yaml
98
+ # Before
99
+ - uses: actions/checkout@v3
100
+ - uses: actions/setup-node@v3
101
+
102
+ # After running actions-up
103
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
104
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
105
+ ```
106
+
107
+ ## Configuration
108
+
109
+ ### Environment Variables
110
+
111
+ - `GITHUB_TOKEN` - GitHub personal access token for API requests (optional but recommended)
112
+
113
+ ## Security
114
+
115
+ Actions Up promotes security best practices:
116
+
117
+ - **SHA Pinning**: Uses commit SHA instead of mutable tags
118
+ - **Version Comments**: Adds version as comment for readability
119
+ - **No Auto-Updates**: Full control over what gets updated
120
+
121
+ ## Contributing
122
+
123
+ See [Contributing Guide](https://github.com/azat-io/actions-up/blob/main/contributing.md).
124
+
125
+ ## License
126
+
127
+ MIT &copy; [Azat S.](https://azat.io)