@ronaldphilipsen/local-action 0.0.0-stage → 7.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 (223) hide show
  1. package/.checkov.yml +3 -0
  2. package/.env.example +379 -0
  3. package/.github/codeql/codeql-config.yml +7 -0
  4. package/.github/copilot-instructions.md +79 -0
  5. package/.github/dependabot.yml +32 -0
  6. package/.github/workflows/codeql-analysis.yml +53 -0
  7. package/.github/workflows/continuous-delivery.yml +93 -0
  8. package/.github/workflows/continuous-integration.yml +382 -0
  9. package/.github/workflows/linter.yml +47 -0
  10. package/.github/workflows/release.yaml +99 -0
  11. package/.github/workflows/version-check.yml +44 -0
  12. package/.grype.yml +151 -0
  13. package/.markdown-lint.yml +7 -0
  14. package/.mega-linter.yml +188 -0
  15. package/.node-version +1 -0
  16. package/.prettierignore +4 -0
  17. package/.prettierrc.yml +14 -0
  18. package/.vscode/launch.json +15 -0
  19. package/.vscode/mcp.json +9 -0
  20. package/.vscode/settings.json +15 -0
  21. package/.vscode/tasks.json +51 -0
  22. package/.yaml-lint.yml +10 -0
  23. package/CHANGELOG.md +75 -0
  24. package/CODEOWNERS +3 -0
  25. package/CODE_OF_CONDUCT.md +74 -0
  26. package/CONTRIBUTING.md +140 -0
  27. package/LICENSE +21 -0
  28. package/README.md +285 -2
  29. package/SECURITY.md +42 -0
  30. package/SUPPORT.md +19 -0
  31. package/__fixtures__/@actions/core.ts +14 -0
  32. package/__fixtures__/@actions/exec.ts +9 -0
  33. package/__fixtures__/@actions/github.ts +3 -0
  34. package/__fixtures__/@actions/http-client.ts +9 -0
  35. package/__fixtures__/@actions/io.ts +9 -0
  36. package/__fixtures__/@octokit/rest.ts +18 -0
  37. package/__fixtures__/crypto.ts +7 -0
  38. package/__fixtures__/fs.ts +27 -0
  39. package/__fixtures__/javascript/no-export/.env.fixture +2 -0
  40. package/__fixtures__/javascript/no-export/action.yml +16 -0
  41. package/__fixtures__/javascript/no-export/node_modules/.gitkeep +0 -0
  42. package/__fixtures__/javascript/no-export/package.json +12 -0
  43. package/__fixtures__/javascript/no-export/src/index.js +0 -0
  44. package/__fixtures__/javascript/no-export/src/main.js +0 -0
  45. package/__fixtures__/javascript/no-import/.env.fixture +2 -0
  46. package/__fixtures__/javascript/no-import/action.yml +16 -0
  47. package/__fixtures__/javascript/no-import/node_modules/.gitkeep +0 -0
  48. package/__fixtures__/javascript/no-import/package.json +12 -0
  49. package/__fixtures__/javascript/no-import/src/index.js +3 -0
  50. package/__fixtures__/javascript/no-import/src/main.js +7 -0
  51. package/__fixtures__/javascript/success/.env.fixture +2 -0
  52. package/__fixtures__/javascript/success/action.yml +16 -0
  53. package/__fixtures__/javascript/success/node_modules/.gitkeep +0 -0
  54. package/__fixtures__/javascript/success/package.json +12 -0
  55. package/__fixtures__/javascript/success/post/index.js +3 -0
  56. package/__fixtures__/javascript/success/post/main.js +13 -0
  57. package/__fixtures__/javascript/success/pre/index.js +3 -0
  58. package/__fixtures__/javascript/success/pre/main.js +13 -0
  59. package/__fixtures__/javascript/success/src/index.js +3 -0
  60. package/__fixtures__/javascript/success/src/main.js +13 -0
  61. package/__fixtures__/javascript-esm/no-import/.env.fixture +2 -0
  62. package/__fixtures__/javascript-esm/no-import/action.yml +16 -0
  63. package/__fixtures__/javascript-esm/no-import/node_modules/.gitkeep +0 -0
  64. package/__fixtures__/javascript-esm/no-import/package.json +13 -0
  65. package/__fixtures__/javascript-esm/no-import/src/index.js +3 -0
  66. package/__fixtures__/javascript-esm/no-import/src/main.js +7 -0
  67. package/__fixtures__/javascript-esm/success/.env.fixture +2 -0
  68. package/__fixtures__/javascript-esm/success/action.yml +16 -0
  69. package/__fixtures__/javascript-esm/success/node_modules/.gitkeep +0 -0
  70. package/__fixtures__/javascript-esm/success/package.json +13 -0
  71. package/__fixtures__/javascript-esm/success/post/index.js +3 -0
  72. package/__fixtures__/javascript-esm/success/post/main.js +13 -0
  73. package/__fixtures__/javascript-esm/success/pre/index.js +3 -0
  74. package/__fixtures__/javascript-esm/success/pre/main.js +13 -0
  75. package/__fixtures__/javascript-esm/success/src/index.js +3 -0
  76. package/__fixtures__/javascript-esm/success/src/main.js +13 -0
  77. package/__fixtures__/path.ts +7 -0
  78. package/__fixtures__/payloads/issue_opened.json +33 -0
  79. package/__fixtures__/stream/promises.ts +3 -0
  80. package/__fixtures__/tsconfig-paths.ts +4 -0
  81. package/__fixtures__/typescript/no-import/.env.fixture +2 -0
  82. package/__fixtures__/typescript/no-import/action.yml +16 -0
  83. package/__fixtures__/typescript/no-import/node_modules/.gitkeep +0 -0
  84. package/__fixtures__/typescript/no-import/package.json +15 -0
  85. package/__fixtures__/typescript/no-import/src/index.ts +3 -0
  86. package/__fixtures__/typescript/no-import/src/main.ts +3 -0
  87. package/__fixtures__/typescript/no-import/tsconfig.json +20 -0
  88. package/__fixtures__/typescript/success/.env.fixture +2 -0
  89. package/__fixtures__/typescript/success/action.yml +16 -0
  90. package/__fixtures__/typescript/success/node_modules/.gitkeep +0 -0
  91. package/__fixtures__/typescript/success/package.json +15 -0
  92. package/__fixtures__/typescript/success/post/index.ts +3 -0
  93. package/__fixtures__/typescript/success/post/main.ts +9 -0
  94. package/__fixtures__/typescript/success/pre/index.ts +3 -0
  95. package/__fixtures__/typescript/success/pre/main.ts +9 -0
  96. package/__fixtures__/typescript/success/src/index.ts +3 -0
  97. package/__fixtures__/typescript/success/src/main.ts +9 -0
  98. package/__fixtures__/typescript/success/tsconfig.json +20 -0
  99. package/__fixtures__/typescript/success-yaml/.env.fixture +2 -0
  100. package/__fixtures__/typescript/success-yaml/action.yaml +16 -0
  101. package/__fixtures__/typescript/success-yaml/node_modules/.gitkeep +0 -0
  102. package/__fixtures__/typescript/success-yaml/package.json +15 -0
  103. package/__fixtures__/typescript/success-yaml/post/index.ts +3 -0
  104. package/__fixtures__/typescript/success-yaml/post/main.ts +9 -0
  105. package/__fixtures__/typescript/success-yaml/pre/index.ts +3 -0
  106. package/__fixtures__/typescript/success-yaml/pre/main.ts +9 -0
  107. package/__fixtures__/typescript/success-yaml/src/index.ts +3 -0
  108. package/__fixtures__/typescript/success-yaml/src/main.ts +9 -0
  109. package/__fixtures__/typescript/success-yaml/tsconfig.json +20 -0
  110. package/__fixtures__/typescript-esm/no-export/.env.fixture +2 -0
  111. package/__fixtures__/typescript-esm/no-export/action.yml +17 -0
  112. package/__fixtures__/typescript-esm/no-export/node_modules/.gitkeep +0 -0
  113. package/__fixtures__/typescript-esm/no-export/package.json +17 -0
  114. package/__fixtures__/typescript-esm/no-export/src/index.ts +0 -0
  115. package/__fixtures__/typescript-esm/no-export/src/main.ts +0 -0
  116. package/__fixtures__/typescript-esm/no-export/tsconfig.json +25 -0
  117. package/__fixtures__/typescript-esm/no-import/.env.fixture +2 -0
  118. package/__fixtures__/typescript-esm/no-import/action.yml +17 -0
  119. package/__fixtures__/typescript-esm/no-import/node_modules/.gitkeep +0 -0
  120. package/__fixtures__/typescript-esm/no-import/package.json +17 -0
  121. package/__fixtures__/typescript-esm/no-import/src/index.ts +3 -0
  122. package/__fixtures__/typescript-esm/no-import/src/main.ts +3 -0
  123. package/__fixtures__/typescript-esm/no-import/tsconfig.json +25 -0
  124. package/__fixtures__/typescript-esm/success/.env.fixture +2 -0
  125. package/__fixtures__/typescript-esm/success/action.yml +17 -0
  126. package/__fixtures__/typescript-esm/success/node_modules/.gitkeep +0 -0
  127. package/__fixtures__/typescript-esm/success/package.json +17 -0
  128. package/__fixtures__/typescript-esm/success/post/index.ts +3 -0
  129. package/__fixtures__/typescript-esm/success/post/main.ts +9 -0
  130. package/__fixtures__/typescript-esm/success/pre/index.ts +3 -0
  131. package/__fixtures__/typescript-esm/success/pre/main.ts +9 -0
  132. package/__fixtures__/typescript-esm/success/src/index.ts +3 -0
  133. package/__fixtures__/typescript-esm/success/src/main.ts +9 -0
  134. package/__fixtures__/typescript-esm/success/tsconfig.json +25 -0
  135. package/__fixtures__/typescript-esm/tsconfig-comments/.env.fixture +2 -0
  136. package/__fixtures__/typescript-esm/tsconfig-comments/action.yml +17 -0
  137. package/__fixtures__/typescript-esm/tsconfig-comments/node_modules/.gitkeep +0 -0
  138. package/__fixtures__/typescript-esm/tsconfig-comments/package.json +17 -0
  139. package/__fixtures__/typescript-esm/tsconfig-comments/src/index.ts +3 -0
  140. package/__fixtures__/typescript-esm/tsconfig-comments/src/main.ts +9 -0
  141. package/__fixtures__/typescript-esm/tsconfig-comments/tsconfig.json +21 -0
  142. package/__tests__/command.test.ts +224 -0
  143. package/__tests__/stubs/artifact/internal/client.test.ts +340 -0
  144. package/__tests__/stubs/artifact/internal/delete/delete-artifact.test.ts +152 -0
  145. package/__tests__/stubs/artifact/internal/download/download-artifact.test.ts +119 -0
  146. package/__tests__/stubs/artifact/internal/find/get-artifact.test.ts +237 -0
  147. package/__tests__/stubs/artifact/internal/find/list-artifacts.test.ts +218 -0
  148. package/__tests__/stubs/artifact/internal/find/retry-options.test.ts +54 -0
  149. package/__tests__/stubs/artifact/internal/shared/config.test.ts +91 -0
  150. package/__tests__/stubs/artifact/internal/shared/errors.test.ts +38 -0
  151. package/__tests__/stubs/artifact/internal/shared/user-agent.test.ts +22 -0
  152. package/__tests__/stubs/artifact/internal/upload/path-and-artifact-name-validation.test.ts +53 -0
  153. package/__tests__/stubs/artifact/internal/upload/upload-artifact.test.ts +126 -0
  154. package/__tests__/stubs/artifact/internal/upload/upload-zip-specification.test.ts +49 -0
  155. package/__tests__/stubs/cache/cache.test.ts +357 -0
  156. package/__tests__/stubs/cache/errors.test.ts +55 -0
  157. package/__tests__/stubs/cache/internal/cacheUtils.test.ts +109 -0
  158. package/__tests__/stubs/cache/internal/constants.test.ts +81 -0
  159. package/__tests__/stubs/cache/internal/tar.test.ts +129 -0
  160. package/__tests__/stubs/core/core.test.ts +760 -0
  161. package/__tests__/stubs/core/path-utils.test.ts +45 -0
  162. package/__tests__/stubs/core/platform.test.ts +89 -0
  163. package/__tests__/stubs/core/summary.test.ts +455 -0
  164. package/__tests__/stubs/env.test.ts +72 -0
  165. package/__tests__/stubs/github/context.test.ts +73 -0
  166. package/__tests__/stubs/github/github.test.ts +15 -0
  167. package/__tests__/stubs/github/internal/utils.test.ts +98 -0
  168. package/__tests__/stubs/github/utils.test.ts +16 -0
  169. package/__tests__/utils/config.test.ts +78 -0
  170. package/__tests__/utils/output.test.ts +32 -0
  171. package/__tests__/utils/package.test.ts +33 -0
  172. package/badges/coverage.svg +1 -0
  173. package/bin/local-action.js +121 -0
  174. package/docs/create-a-job-summary.md +32 -0
  175. package/docs/debugging-in-vscode.md +27 -0
  176. package/docs/img/job-summary.png +0 -0
  177. package/docs/supported-functionality.md +126 -0
  178. package/eslint.config.mjs +74 -0
  179. package/jest.config.ts +41 -0
  180. package/package.json +93 -4
  181. package/src/command.ts +171 -0
  182. package/src/commands/run.ts +616 -0
  183. package/src/index.ts +21 -0
  184. package/src/stubs/artifact/artifact.ts +17 -0
  185. package/src/stubs/artifact/internal/client.ts +400 -0
  186. package/src/stubs/artifact/internal/delete/delete-artifact.ts +126 -0
  187. package/src/stubs/artifact/internal/download/download-artifact.ts +309 -0
  188. package/src/stubs/artifact/internal/find/get-artifact.ts +135 -0
  189. package/src/stubs/artifact/internal/find/list-artifacts.ts +188 -0
  190. package/src/stubs/artifact/internal/find/retry-options.ts +57 -0
  191. package/src/stubs/artifact/internal/shared/config.ts +64 -0
  192. package/src/stubs/artifact/internal/shared/errors.ts +53 -0
  193. package/src/stubs/artifact/internal/shared/interfaces.ts +195 -0
  194. package/src/stubs/artifact/internal/shared/user-agent.ts +13 -0
  195. package/src/stubs/artifact/internal/upload/path-and-artifact-name-validation.ts +92 -0
  196. package/src/stubs/artifact/internal/upload/upload-artifact.ts +127 -0
  197. package/src/stubs/artifact/internal/upload/upload-zip-specification.ts +108 -0
  198. package/src/stubs/artifact/internal/upload/zip.ts +122 -0
  199. package/src/stubs/cache/cache.ts +334 -0
  200. package/src/stubs/cache/errors.ts +31 -0
  201. package/src/stubs/cache/interfaces.ts +4 -0
  202. package/src/stubs/cache/internal/cacheUtils.ts +207 -0
  203. package/src/stubs/cache/internal/constants.ts +45 -0
  204. package/src/stubs/cache/internal/tar.ts +374 -0
  205. package/src/stubs/cache/options.ts +91 -0
  206. package/src/stubs/core/core.ts +743 -0
  207. package/src/stubs/core/path-utils.ts +39 -0
  208. package/src/stubs/core/platform.ts +132 -0
  209. package/src/stubs/core/summary.ts +399 -0
  210. package/src/stubs/env.ts +40 -0
  211. package/src/stubs/github/context.ts +94 -0
  212. package/src/stubs/github/github.ts +29 -0
  213. package/src/stubs/github/interfaces.ts +52 -0
  214. package/src/stubs/github/internal/utils.ts +83 -0
  215. package/src/stubs/github/utils.ts +52 -0
  216. package/src/types/quibble.d.ts +5 -0
  217. package/src/types.ts +116 -0
  218. package/src/utils/config.ts +47 -0
  219. package/src/utils/output.ts +20 -0
  220. package/src/utils/package.ts +38 -0
  221. package/tsconfig.base.json +29 -0
  222. package/tsconfig.eslint.json +22 -0
  223. package/tsconfig.json +18 -0
@@ -0,0 +1,140 @@
1
+ # Contributing
2
+
3
+ All contributions are welcome and greatly appreciated! However, please try to
4
+ keep them limited in scope so that they can be more easily reviewed.
5
+
6
+ ## Steps to Contribute
7
+
8
+ > [!WARNING]
9
+ >
10
+ > Check the `engine` property in [`package.json`](./package.json) to see what
11
+ > version of Node.js is required for local development. This can be different
12
+ > from the version of Node.js used on the GitHub Actions runners. Tools like
13
+ > [nodenv](https://github.com/nodenv/nodenv) can be used to manage your Node.js
14
+ > version automatically.
15
+
16
+ 1. Fork this repository
17
+ 1. Clone your fork
18
+ 1. Install the dependencies with `npm install`
19
+ 1. Make and test your changes
20
+ 1. Commit your changes
21
+
22
+ Make sure to do the following when you commit your changes:
23
+ - Increase the version number in [`package.json`](./package.json)
24
+ - Run `npm install` to ensure dependencies are up to date
25
+ - Run `npm run all` to run formatting, linting, etc.
26
+
27
+ 1. Open a pull request back to this repository
28
+ 1. Notify the maintainers of this repository for peer review and approval
29
+ 1. Merge :tada:
30
+
31
+ The maintainers of this repository will create a new release with your changes
32
+ so that everyone can enjoy your contributions!
33
+
34
+ ## Testing
35
+
36
+ This project requires **100%** test coverage.
37
+
38
+ > [!IMPORTANT]
39
+ >
40
+ > It is critical that we have 100% test coverage to ensure that we are not
41
+ > introducing any regressions. All changes will be throughly tested by
42
+ > maintainers of this repository before a new release is created.
43
+
44
+ ### Testing Local Updates
45
+
46
+ As you make changes, it's a great idea to run the `local-action` tool regularly
47
+ against various repositories with different configurations.
48
+
49
+ 1. Symlink your package folder (this should only need to be done once)
50
+
51
+ ```bash
52
+ npm link
53
+ ```
54
+
55
+ 1. Test your updated version
56
+
57
+ ```bash
58
+ local-action run <path> <entrypoint> <dotenv file>
59
+
60
+ # Or...
61
+ npm exec local-action run <path> <entrypoint> <dotenv file>
62
+ ```
63
+
64
+ Once you're finished testing, make sure to unlink!
65
+
66
+ ```bash
67
+ npm unlink @github/local-action
68
+ ```
69
+
70
+ #### Example Actions to Test
71
+
72
+ After making updates and running the test suite, please also make sure to test
73
+ your updates using the following GitHub Actions repositories:
74
+
75
+ - [`actions/javascript-action`](https://github.com/actions/javascript-action)
76
+ - [`actions/typescript-action`](https://github.com/actions/typescript-action)
77
+
78
+ 1. Clone each repository locally
79
+ 1. From your `github/local-action` fork, test each action
80
+
81
+ ```bash
82
+ npm exec local-action \
83
+ "/<action repository clone path>/typescript-action" \
84
+ "src/main.ts" \
85
+ "<path to your .env file>"
86
+
87
+ npm exec local-action \
88
+ "/<action repository clone path>/javascript-action" \
89
+ "src/main.ts" \
90
+ "<path to your .env file>"
91
+ ```
92
+
93
+ For an example `.env` file to use for testing, see
94
+ [`.env.example`](./.env.example).
95
+
96
+ ### Running the Test Suite
97
+
98
+ Simply run the following command to invoke the entire test suite:
99
+
100
+ ```bash
101
+ npm run test
102
+ ```
103
+
104
+ > [!NOTE]
105
+ >
106
+ > This requires that you have already run `npm install`
107
+
108
+ ### Toolkit Stub Updates
109
+
110
+ When updating any of the supported stubs for the GitHub Actions Toolkit, please
111
+ make sure to also update the following. This helps ensure that we are using the
112
+ latest supported versions of the toolkit packages, and makes comparing changes
113
+ across commits easier.
114
+
115
+ 1. The supported version in the [`README.md`](./README.md)
116
+
117
+ ```markdown
118
+ | Package | Version |
119
+ | ---------------------------------------------------------------------- | -------- |
120
+ | [`@actions/artifact`](https://www.npmjs.com/package/@actions/artifact) | `2.3.2` |
121
+ | [`@actions/core`](https://www.npmjs.com/package/@actions/core) | `1.11.1` |
122
+ | [`@actions/github`](https://www.npmjs.com/package/@actions/github) | `6.0.1` |
123
+ ```
124
+
125
+ 1. The latest reviewed commit URL in the corresponding `src/stubs/*.ts` file
126
+
127
+ ```typescript
128
+ /**
129
+ * Last Reviewed Commit: https://github.com/actions/toolkit/blob/f58042f9cc16bcaa87afaa86c2974a8c771ce1ea/packages/artifact/src/artifact.ts
130
+ * Last Reviewed Date: 2025-09-10
131
+ */
132
+ ```
133
+
134
+ When comparing commits to see what has been updated in the toolkit packages, be
135
+ sure to compare against the last reviewed commit in the corresponding stub file.
136
+ This can be done more easily using the following URL format:
137
+
138
+ ```plain
139
+ https://github.com/actions/toolkit/compare/<old commit>..main
140
+ ```
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright GitHub
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, 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,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,286 @@
1
- # Temporary Holding Version
1
+ # Local Action Debugger
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ![Continuous Integration](https://github.com/RonaldPhilipsen/local-action/actions/workflows/continuous-integration.yml/badge.svg)
4
+ ![Code Coverage](badges/coverage.svg)
5
+
6
+ > [!IMPORTANT]
7
+ >
8
+ > This is a fork of
9
+ > [`github/local-action`](https://github.com/github/local-action), republished
10
+ > as
11
+ > [`@ronaldphilipsen/local-action`](https://www.npmjs.com/package/@ronaldphilipsen/local-action)
12
+ > with **Node.js 26 support**. Releases are published to npm (via trusted
13
+ > publishing) and to GitHub Packages.
14
+
15
+ Run custom GitHub Actions locally and test them in Visual Studio Code!
16
+
17
+ This command-line tool emulates some **basic** functionality of the
18
+ [GitHub Actions Toolkit](https://github.com/actions/toolkit) so that custom
19
+ actions can be run directly on your workstation.
20
+
21
+ > [!NOTE]
22
+ >
23
+ > This tool currently only supports JavaScript and TypeScript actions!
24
+
25
+ The following table tracks the versions of the GitHub Actions Toolkit that are
26
+ currently implemented by this tool.
27
+
28
+ | Package | Version |
29
+ | ---------------------------------------------------------------------- | ------- |
30
+ | [`@actions/artifact`](https://www.npmjs.com/package/@actions/artifact) | `5.0.2` |
31
+ | [`@actions/cache`](https://www.npmjs.com/package/@actions/cache) | `5.0.3` |
32
+ | [`@actions/core`](https://www.npmjs.com/package/@actions/core) | `2.0.2` |
33
+ | [`@actions/github`](https://www.npmjs.com/package/@actions/github) | `7.0.0` |
34
+
35
+ ## Changelog
36
+
37
+ See the [CHANGELOG](./CHANGELOG.md) for a complete list of changes.
38
+
39
+ ## Node.js Version Support
40
+
41
+ This tool is currently tested against **Node.js versions 22, 24 and 26**. It is
42
+ not guaranteed to work with other versions at this time.
43
+
44
+ ## Package Manager Support
45
+
46
+ ### `npm` Support
47
+
48
+ This tool is designed primarily for use with `npm` and `npx`. It is recommended
49
+ to use `npm` for managing actions you wish to test with this tool.
50
+
51
+ ### `pnpm` Support
52
+
53
+ This tool ships with **experimental** support for `pnpm`. If you encounter any
54
+ issues, please [file an issue](https://github.com/github/local-action/issues).
55
+
56
+ Some caveats to this support are listed below.
57
+
58
+ - This tool does not support CommonJS actions using `pnpm`.
59
+
60
+ ### `yarn` Support
61
+
62
+ This tool ships with **experimental** support for `yarn`. If you encounter any
63
+ issues, please [file an issue](https://github.com/github/local-action/issues).
64
+
65
+ Some caveats to this support are listed below.
66
+
67
+ - The `@github/local-action` package should be run using
68
+ `yarn dlx @github/local-action` instead of `yarn local-action`.
69
+ - This tool does not support CommonJS actions using `yarn`.
70
+
71
+ ## Prerequisites
72
+
73
+ ### Installed Tools
74
+
75
+ - [Node.js and npm](https://nodejs.org/en)
76
+
77
+ ### Action Structure
78
+
79
+ For JavaScript and TypeScript actions, your code should follow the format of the
80
+ corresponding template repository.
81
+
82
+ - [`actions/javascript-action`](https://github.com/actions/javascript-action)
83
+ - [`actions/typescript-action`](https://github.com/actions/typescript-action)
84
+
85
+ Specifically, there should be a separation between the entrypoint used by GitHub
86
+ Actions when invoking your code, and the actual logic of your action. For
87
+ example:
88
+
89
+ #### Entrypoint: **`index.ts`**
90
+
91
+ This is what is invoked by GitHub Actions when your action is run.
92
+
93
+ ```typescript
94
+ /**
95
+ * This file is the entrypoint for the action
96
+ */
97
+ import { run } from './main'
98
+
99
+ // It calls the actual logic of the action
100
+ run()
101
+ ```
102
+
103
+ #### Logic: **`main.ts`**
104
+
105
+ This is the actual implementation of your action. It is called by the
106
+ entrypoint.
107
+
108
+ ```typescript
109
+ import * as core from '@actions/core'
110
+ import { wait } from './wait'
111
+
112
+ /**
113
+ * This file is the actual logic of the action
114
+ * @returns {Promise<void>} Resolves when the action is complete
115
+ */
116
+ export async function run(): Promise<void> {
117
+ // ...
118
+ }
119
+ ```
120
+
121
+ ### Transpiled Actions
122
+
123
+ Depending on how you build your JavaScript/TypeScript actions, you may do one of
124
+ the following when preparing for release:
125
+
126
+ - Commit the `node_modules` directory to your repository
127
+ - Transpile your code and dependencies using tools like
128
+ [`tsc`](https://www.typescriptlang.org/docs/handbook/compiler-options.html),
129
+ [`@vercel/ncc`](https://www.npmjs.com/package/@vercel/ncc), or
130
+ [`rollup`](https://rollupjs.org/)
131
+
132
+ **This tool supports non-transpiled action code only.** This is because it uses
133
+ [`quibble`](https://github.com/testdouble/quibble) to override GitHub Actions
134
+ Toolkit dependencies (e.g
135
+ [`@actions/core`](https://www.npmjs.com/package/@actions/core)). In transpiled
136
+ code, this simply doesn't work.
137
+
138
+ For example, if you have a TypeScript action that follows the same format as the
139
+ [template](https://github.com/actions/typescript-action), you would have both
140
+ `src` and `dist` directories in your repository. The `dist` directory contains
141
+ the transpiled code with any dependencies included. When running this utility,
142
+ you will want to target the code files in the `src` directory instead (including
143
+ the dependencies this tool wants to replace). This has the added benefit of
144
+ being able to hook into debugging utilities in your IDE :tada:
145
+
146
+ For additional information about transpiled action code, see
147
+ [Commit, tag, and push your action to GitHub](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#commit-tag-and-push-your-action-to-github).
148
+
149
+ ## Installation
150
+
151
+ ### Option 1: Install from npm
152
+
153
+ 1. Install via `npm`
154
+
155
+ ```bash
156
+ npm i -g @github/local-action
157
+ ```
158
+
159
+ ### Option 2: Clone this Repository
160
+
161
+ 1. Clone this repository locally
162
+
163
+ ```bash
164
+ git clone https://github.com/github/local-action.git
165
+ ```
166
+
167
+ 1. Install dependencies
168
+
169
+ ```bash
170
+ npm ci
171
+ ```
172
+
173
+ 1. Install via `npm`
174
+
175
+ ```bash
176
+ npm i -g .
177
+ ```
178
+
179
+ Alternatively, you can link the package if you want to make code changes
180
+
181
+ ```bash
182
+ npm link .
183
+ ```
184
+
185
+ ## Commands
186
+
187
+ ### `local-action`
188
+
189
+ | Option | Description |
190
+ | ----------------- | --------------------------- |
191
+ | `-h`, `--help` | Display help information |
192
+ | `-V`, `--version` | Display version information |
193
+
194
+ ### `local-action run <path> <logic entrypoint> <dotenv file> [--pre <pre entrypoint>] [--post <post entrypoint>]`
195
+
196
+ | Argument | Description |
197
+ | -------------------------- | ------------------------------------------------------------------- |
198
+ | `path` | Path to the local action directory |
199
+ | | Example: `/path/to/action.yml` |
200
+ | `logic entrypoint` | Action logic entrypoint (relative to action directory) |
201
+ | | Example: `src/main.ts` |
202
+ | `dotenv file` | Path to the local `.env` file for action inputs |
203
+ | | Example: `/path/to/.env` |
204
+ | | See the example [`.env.example`](.env.example) |
205
+ | `--pre <pre entrypoint>` | (Optional) `pre` command entrypoint (relative to action directory) |
206
+ | | Example: `pre/main.ts` |
207
+ | `--post <post entrypoint>` | (Optional) `post` command entrypoint (relative to action directory) |
208
+ | | Example: `post/main.ts` |
209
+
210
+ Examples:
211
+
212
+ ```bash
213
+ local-action run /path/to/typescript-action src/main.ts .env --pre pre/main.ts --post post/main.ts
214
+
215
+ # The `run` action is invoked by default as well
216
+ local-action /path/to/typescript-action src/main.ts .env --pre pre/main.ts --post post/main.ts
217
+ ```
218
+
219
+ #### Output
220
+
221
+ ```console
222
+ $ local-action run /path/to/typescript-action src/main.ts .env --pre pre/main.ts --post post/main.ts
223
+ _ _ _ ____ _
224
+ / \ ___| |_(_) ___ _ __ | _ \ ___| |__ _ _ __ _ __ _ ___ _ __
225
+ / _ \ / __| __| |/ _ \| '_ \ | | | |/ _ \ '_ \| | | |/ _` |/ _` |/ _ \ '__|
226
+ / ___ \ (__| |_| | (_) | | | | | |_| | __/ |_) | |_| | (_| | (_| | __/ |
227
+ /_/ \_\___|\__|_|\___/|_| |_| |____/ \___|_.__/ \__,_|\__, |\__, |\___|_|
228
+ |___/ |___/
229
+ ================================================================================
230
+ Configuration
231
+ ================================================================================
232
+
233
+ ┌─────────┬────────────────────┬───────────────────────────────────────────┐
234
+ │ (index) │ Field │ Value │
235
+ ├─────────┼────────────────────┼───────────────────────────────────────────┤
236
+ │ 0 │ 'Action Path' │ '/path/to/typescript-action' │
237
+ │ 1 │ 'Entrypoint' │ '/path/to/typescript-action/src/main.ts' │
238
+ │ 2 │ 'Environment File' │ '/path/to/local-action-debugger/.env' │
239
+ └─────────┴────────────────────┴───────────────────────────────────────────┘
240
+
241
+ ================================================================================
242
+ Action Metadata
243
+ ================================================================================
244
+
245
+ ┌─────────┬────────────────┬───────────────────────────────┐
246
+ │ (index) │ Input │ Description │
247
+ ├─────────┼────────────────┼───────────────────────────────┤
248
+ │ 0 │ 'milliseconds' │ 'Your input description here' │
249
+ └─────────┴────────────────┴───────────────────────────────┘
250
+
251
+ ┌─────────┬────────┬────────────────────────────────┐
252
+ │ (index) │ Output │ Description │
253
+ ├─────────┼────────┼────────────────────────────────┤
254
+ │ 0 │ 'time' │ 'Your output description here' │
255
+ └─────────┴────────┴────────────────────────────────┘
256
+
257
+ ================================================================================
258
+ Running Action
259
+ ================================================================================
260
+ ```
261
+
262
+ ## (TypeScript) TSConfig Requirements
263
+
264
+ If you are testing TypeScript actions, there are a few settings that **must** be
265
+ configured in your `tsconfig.json` file (either explicitly or via their default
266
+ values).
267
+
268
+ | Property | Required Value |
269
+ | ------------------------------------------------------------- | -------------- |
270
+ | [`allowJs`](https://www.typescriptlang.org/tsconfig/#allowJs) | `false` |
271
+
272
+ ### Troubleshooting
273
+
274
+ Possible errors that can arise from not having `allowJs: false`:
275
+
276
+ - `TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file` from tsx
277
+ when trying to run `npx @github/local-action`.
278
+
279
+ ## Features
280
+
281
+ The following list links to documentation on how to use various features of the
282
+ `local-action` tool.
283
+
284
+ - [Supported Functionality](./docs//supported-functionality.md)
285
+ - [Debugging in Visual Studio Code](./docs/debugging-in-vscode.md)
286
+ - [Create a Job Summary](./docs/create-a-job-summary.md)
package/SECURITY.md ADDED
@@ -0,0 +1,42 @@
1
+ # Security
2
+
3
+ Thanks for helping make GitHub safe for everyone!
4
+
5
+ GitHub takes the security of our software products and services seriously,
6
+ including all of the open source code repositories managed through our GitHub
7
+ organizations, such as [GitHub](https://github.com/GitHub).
8
+
9
+ Even though
10
+ [open source repositories are outside of the scope of our bug bounty program](https://bounty.github.com/index.html#scope)
11
+ and therefore not eligible for bounty rewards, we will ensure that your finding
12
+ gets passed along to the appropriate maintainers for remediation.
13
+
14
+ ## Reporting Security Issues
15
+
16
+ If you believe you have found a security vulnerability in any GitHub-owned
17
+ repository, please report it to us through coordinated disclosure.
18
+
19
+ **Please do not report security vulnerabilities through public GitHub issues,
20
+ discussions, or pull requests.**
21
+
22
+ Instead, please send an email to
23
+ [opensource-security@github.com](mailto:opensource-security@github.com).
24
+
25
+ Please include as much of the information listed below as you can to help us
26
+ better understand and resolve the issue:
27
+
28
+ - The type of issue (e.g., buffer overflow, SQL injection, or cross-site
29
+ scripting)
30
+ - Full paths of source file(s) related to the manifestation of the issue
31
+ - The location of the affected source code (tag/branch/commit or direct URL)
32
+ - Any special configuration required to reproduce the issue
33
+ - Step-by-step instructions to reproduce the issue
34
+ - Proof-of-concept or exploit code (if possible)
35
+ - Impact of the issue, including how an attacker might exploit the issue
36
+
37
+ This information will help us triage your report more quickly.
38
+
39
+ ## Policy
40
+
41
+ See
42
+ [GitHub's Safe Harbor Policy](https://docs.github.com/en/site-policy/security-policies/github-bug-bounty-program-legal-safe-harbor#1-safe-harbor-terms)
package/SUPPORT.md ADDED
@@ -0,0 +1,19 @@
1
+ # Support
2
+
3
+ ## How to Get Help
4
+
5
+ This project uses GitHub issues to track bugs and feature requests. Please
6
+ search the existing issues before filing new issues to avoid duplicates. For new
7
+ issues, file your bug or feature request as a new issue.
8
+
9
+ For help or questions about using this project, please feel free to submit an
10
+ issue as well.
11
+
12
+ This project is under development and maintained by GitHub staff and the
13
+ community, however availability is limited . We will do our best to respond to
14
+ support, feature requests, and community questions in a timely manner, but there
15
+ is no "official" support for this project at this time.
16
+
17
+ ## GitHub Support Policy
18
+
19
+ Support for this project is limited to the resources listed above.
@@ -0,0 +1,14 @@
1
+ import { jest } from '@jest/globals'
2
+
3
+ export const debug = jest.fn().mockImplementation(() => {})
4
+ export const error = jest.fn().mockImplementation(() => {})
5
+ export const info = jest.fn().mockImplementation(() => {})
6
+ export const isDebug = jest.fn().mockImplementation(() => false)
7
+ export const getInput = jest.fn().mockImplementation(() => {})
8
+ export const setOutput = jest.fn().mockImplementation(() => {})
9
+ export const setFailed = jest.fn().mockImplementation(() => {})
10
+ export const warning = jest.fn().mockImplementation(() => {})
11
+ export const summary = {
12
+ addRaw: jest.fn().mockImplementation(() => {}),
13
+ write: jest.fn().mockImplementation(() => {})
14
+ }
@@ -0,0 +1,9 @@
1
+ import { jest } from '@jest/globals'
2
+
3
+ export const exec = jest.fn().mockImplementation(() => {})
4
+ export const getExecOutput = jest.fn().mockImplementation(() => {})
5
+
6
+ export default {
7
+ exec,
8
+ getExecOutput
9
+ }
@@ -0,0 +1,3 @@
1
+ import * as octokit from '../@octokit/rest.js'
2
+
3
+ export const getOctokit = () => octokit
@@ -0,0 +1,9 @@
1
+ import { jest } from '@jest/globals'
2
+
3
+ export const getAgent = jest.fn()
4
+ export const getAgentDispatcher = jest.fn()
5
+
6
+ export class HttpClient {
7
+ getAgent = getAgent
8
+ getAgentDispatcher = getAgentDispatcher
9
+ }
@@ -0,0 +1,9 @@
1
+ import { jest } from '@jest/globals'
2
+
3
+ export const which = jest.fn().mockImplementation(() => {})
4
+ export const mkdirP = jest.fn().mockImplementation(() => {})
5
+
6
+ export default {
7
+ which,
8
+ mkdirP
9
+ }
@@ -0,0 +1,18 @@
1
+ import { jest } from '@jest/globals'
2
+ import { Endpoints } from '@octokit/types'
3
+
4
+ export const graphql = jest.fn()
5
+ export const paginate = jest.fn()
6
+ export const request = jest.fn()
7
+ export const rest = {
8
+ actions: {
9
+ deleteArtifact:
10
+ jest.fn<
11
+ () => Endpoints['DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}']['response']
12
+ >(),
13
+ listWorkflowRunArtifacts:
14
+ jest.fn<
15
+ () => Endpoints['GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts']['response']
16
+ >()
17
+ }
18
+ }
@@ -0,0 +1,7 @@
1
+ import { jest } from '@jest/globals'
2
+
3
+ export const createHash = jest.fn()
4
+
5
+ export default {
6
+ createHash
7
+ }
@@ -0,0 +1,27 @@
1
+ import { jest } from '@jest/globals'
2
+
3
+ export const accessSync = jest.fn()
4
+ export const copyFileSync = jest.fn()
5
+ export const createWriteStream = jest.fn()
6
+ export const createReadStream = jest.fn()
7
+ export const existsSync = jest.fn()
8
+ export const mkdirSync = jest.fn()
9
+ export const readdirSync = jest.fn()
10
+ export const readFileSync = jest.fn()
11
+ export const rmSync = jest.fn()
12
+ export const statSync = jest.fn()
13
+ export const writeFileSync = jest.fn()
14
+
15
+ export default {
16
+ accessSync,
17
+ copyFileSync,
18
+ createWriteStream,
19
+ createReadStream,
20
+ existsSync,
21
+ mkdirSync,
22
+ readdirSync,
23
+ readFileSync,
24
+ rmSync,
25
+ statSync,
26
+ writeFileSync
27
+ }
@@ -0,0 +1,2 @@
1
+ ACTIONS_STEP_DEBUG=false
2
+ INPUT_MILLISECONDS=2400
@@ -0,0 +1,16 @@
1
+ name: JavaScript (No Import)
2
+ description: This action doesn't import any dependencies
3
+
4
+ inputs:
5
+ myInput:
6
+ description: An input
7
+ required: true
8
+ default: value
9
+
10
+ outputs:
11
+ myOutput:
12
+ description: An output
13
+
14
+ runs:
15
+ using: node20
16
+ main: dist/index.js
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "javascript-action",
3
+ "description": "GitHub Actions JavaScript template",
4
+ "version": "0.0.0",
5
+ "engines": {
6
+ "node": ">=24"
7
+ },
8
+ "dependencies": {
9
+ "@actions/core": "^2.0.2"
10
+ },
11
+ "devDependencies": {}
12
+ }
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ ACTIONS_STEP_DEBUG=false
2
+ INPUT_MILLISECONDS=2400