@trebired/git-host 2.2.0 → 3.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 (286) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +103 -11
  3. package/dist/api/forge/actions/filters.d.ts +10 -0
  4. package/dist/api/forge/actions/filters.d.ts.map +1 -0
  5. package/dist/api/forge/actions/filters.js +63 -0
  6. package/dist/api/forge/actions/filters.js.map +1 -0
  7. package/dist/api/forge/actions/run.d.ts +8 -0
  8. package/dist/api/forge/actions/run.d.ts.map +1 -0
  9. package/dist/api/forge/actions/run.js +129 -0
  10. package/dist/api/forge/actions/run.js.map +1 -0
  11. package/dist/api/forge/actions.d.ts +3 -12
  12. package/dist/api/forge/actions.d.ts.map +1 -1
  13. package/dist/api/forge/actions.js +2 -216
  14. package/dist/api/forge/actions.js.map +1 -1
  15. package/dist/api/handler/response.d.ts.map +1 -1
  16. package/dist/api/handler/response.js +55 -1
  17. package/dist/api/handler/response.js.map +1 -1
  18. package/dist/core/actions/environment.d.ts +9 -0
  19. package/dist/core/actions/environment.d.ts.map +1 -0
  20. package/dist/core/actions/environment.js +64 -0
  21. package/dist/core/actions/environment.js.map +1 -0
  22. package/dist/core/actions/expressions/read.d.ts +7 -0
  23. package/dist/core/actions/expressions/read.d.ts.map +1 -0
  24. package/dist/core/actions/expressions/read.js +148 -0
  25. package/dist/core/actions/expressions/read.js.map +1 -0
  26. package/dist/core/actions/expressions/tokenize.d.ts +4 -0
  27. package/dist/core/actions/expressions/tokenize.d.ts.map +1 -0
  28. package/dist/core/actions/expressions/tokenize.js +112 -0
  29. package/dist/core/actions/expressions/tokenize.js.map +1 -0
  30. package/dist/core/actions/expressions/types.d.ts +38 -0
  31. package/dist/core/actions/expressions/types.d.ts.map +1 -0
  32. package/dist/core/actions/expressions/types.js +2 -0
  33. package/dist/core/actions/expressions/types.js.map +1 -0
  34. package/dist/core/actions/expressions.d.ts +2 -9
  35. package/dist/core/actions/expressions.d.ts.map +1 -1
  36. package/dist/core/actions/expressions.js +2 -256
  37. package/dist/core/actions/expressions.js.map +1 -1
  38. package/dist/core/actions/local_runner.d.ts +5 -0
  39. package/dist/core/actions/local_runner.d.ts.map +1 -1
  40. package/dist/core/actions/local_runner.js +70 -18
  41. package/dist/core/actions/local_runner.js.map +1 -1
  42. package/dist/core/actions/node_runner.d.ts.map +1 -1
  43. package/dist/core/actions/node_runner.js +2 -1
  44. package/dist/core/actions/node_runner.js.map +1 -1
  45. package/dist/core/actions/normalize/finalize.d.ts +7 -0
  46. package/dist/core/actions/normalize/finalize.d.ts.map +1 -0
  47. package/dist/core/actions/normalize/finalize.js +70 -0
  48. package/dist/core/actions/normalize/finalize.js.map +1 -0
  49. package/dist/core/actions/normalize/shared.d.ts +19 -0
  50. package/dist/core/actions/normalize/shared.d.ts.map +1 -0
  51. package/dist/core/actions/normalize/shared.js +289 -0
  52. package/dist/core/actions/normalize/shared.js.map +1 -0
  53. package/dist/core/actions/normalize.d.ts +1 -3
  54. package/dist/core/actions/normalize.d.ts.map +1 -1
  55. package/dist/core/actions/normalize.js +2 -354
  56. package/dist/core/actions/normalize.js.map +1 -1
  57. package/dist/core/actions/redaction.d.ts +13 -2
  58. package/dist/core/actions/redaction.d.ts.map +1 -1
  59. package/dist/core/actions/redaction.js +20 -5
  60. package/dist/core/actions/redaction.js.map +1 -1
  61. package/dist/core/actions/release_assets.d.ts.map +1 -1
  62. package/dist/core/actions/release_assets.js.map +1 -1
  63. package/dist/core/actions/runner/launch.d.ts.map +1 -1
  64. package/dist/core/actions/runner/launch.js +12 -8
  65. package/dist/core/actions/runner/launch.js.map +1 -1
  66. package/dist/core/actions/sandbox.d.ts +4 -0
  67. package/dist/core/actions/sandbox.d.ts.map +1 -0
  68. package/dist/core/actions/sandbox.js +46 -0
  69. package/dist/core/actions/sandbox.js.map +1 -0
  70. package/dist/core/archive/commit.d.ts +6 -0
  71. package/dist/core/archive/commit.d.ts.map +1 -0
  72. package/dist/core/archive/commit.js +34 -0
  73. package/dist/core/archive/commit.js.map +1 -0
  74. package/dist/core/archive/context.d.ts +32 -0
  75. package/dist/core/archive/context.d.ts.map +1 -0
  76. package/dist/core/archive/context.js +61 -0
  77. package/dist/core/archive/context.js.map +1 -0
  78. package/dist/core/archive/generation.d.ts +11 -0
  79. package/dist/core/archive/generation.d.ts.map +1 -0
  80. package/dist/core/archive/generation.js +62 -0
  81. package/dist/core/archive/generation.js.map +1 -0
  82. package/dist/core/archive/links.d.ts +5 -0
  83. package/dist/core/archive/links.d.ts.map +1 -0
  84. package/dist/core/archive/links.js +62 -0
  85. package/dist/core/archive/links.js.map +1 -0
  86. package/dist/core/archive/open.d.ts +15 -0
  87. package/dist/core/archive/open.d.ts.map +1 -0
  88. package/dist/core/archive/open.js +159 -0
  89. package/dist/core/archive/open.js.map +1 -0
  90. package/dist/core/archive/read.d.ts +19 -0
  91. package/dist/core/archive/read.d.ts.map +1 -0
  92. package/dist/core/archive/read.js +62 -0
  93. package/dist/core/archive/read.js.map +1 -0
  94. package/dist/core/archive/resolve.d.ts +8 -0
  95. package/dist/core/archive/resolve.d.ts.map +1 -0
  96. package/dist/core/archive/resolve.js +67 -0
  97. package/dist/core/archive/resolve.js.map +1 -0
  98. package/dist/core/archive/shared.d.ts +50 -0
  99. package/dist/core/archive/shared.d.ts.map +1 -0
  100. package/dist/core/archive/shared.js +119 -0
  101. package/dist/core/archive/shared.js.map +1 -0
  102. package/dist/core/archive.d.ts +2 -18
  103. package/dist/core/archive.d.ts.map +1 -1
  104. package/dist/core/archive.js +16 -556
  105. package/dist/core/archive.js.map +1 -1
  106. package/dist/core/create/git/forge/base_methods.d.ts +5 -0
  107. package/dist/core/create/git/forge/base_methods.d.ts.map +1 -0
  108. package/dist/core/create/git/forge/base_methods.js +59 -0
  109. package/dist/core/create/git/forge/base_methods.js.map +1 -0
  110. package/dist/core/create/git/forge/context.d.ts +38 -0
  111. package/dist/core/create/git/forge/context.d.ts.map +1 -0
  112. package/dist/core/create/git/forge/context.js +174 -0
  113. package/dist/core/create/git/forge/context.js.map +1 -0
  114. package/dist/core/create/git/forge/fork_methods.d.ts +5 -0
  115. package/dist/core/create/git/forge/fork_methods.d.ts.map +1 -0
  116. package/dist/core/create/git/forge/fork_methods.js +133 -0
  117. package/dist/core/create/git/forge/fork_methods.js.map +1 -0
  118. package/dist/core/create/git/forge/release_methods.d.ts +5 -0
  119. package/dist/core/create/git/forge/release_methods.d.ts.map +1 -0
  120. package/dist/core/create/git/forge/release_methods.js +116 -0
  121. package/dist/core/create/git/forge/release_methods.js.map +1 -0
  122. package/dist/core/create/git/forge/shared.d.ts +9 -0
  123. package/dist/core/create/git/forge/shared.d.ts.map +1 -0
  124. package/dist/core/create/git/forge/shared.js +80 -0
  125. package/dist/core/create/git/forge/shared.js.map +1 -0
  126. package/dist/core/create/git/forge/social_methods.d.ts +5 -0
  127. package/dist/core/create/git/forge/social_methods.d.ts.map +1 -0
  128. package/dist/core/create/git/forge/social_methods.js +31 -0
  129. package/dist/core/create/git/forge/social_methods.js.map +1 -0
  130. package/dist/core/create/git/forge.d.ts.map +1 -1
  131. package/dist/core/create/git/forge.js +10 -594
  132. package/dist/core/create/git/forge.js.map +1 -1
  133. package/dist/core/create/git/host.d.ts.map +1 -1
  134. package/dist/core/create/git/host.js +139 -114
  135. package/dist/core/create/git/host.js.map +1 -1
  136. package/dist/core/create_git_host/remote_methods.d.ts.map +1 -1
  137. package/dist/core/create_git_host/remote_methods.js +92 -97
  138. package/dist/core/create_git_host/remote_methods.js.map +1 -1
  139. package/dist/core/forge_actions/job/release_asset.d.ts +17 -0
  140. package/dist/core/forge_actions/job/release_asset.d.ts.map +1 -0
  141. package/dist/core/forge_actions/job/release_asset.js +62 -0
  142. package/dist/core/forge_actions/job/release_asset.js.map +1 -0
  143. package/dist/core/forge_actions/job/steps.d.ts +37 -0
  144. package/dist/core/forge_actions/job/steps.d.ts.map +1 -0
  145. package/dist/core/forge_actions/job/steps.js +228 -0
  146. package/dist/core/forge_actions/job/steps.js.map +1 -0
  147. package/dist/core/forge_actions/runtime/api.d.ts +26 -0
  148. package/dist/core/forge_actions/runtime/api.d.ts.map +1 -0
  149. package/dist/core/forge_actions/runtime/api.js +210 -0
  150. package/dist/core/forge_actions/runtime/api.js.map +1 -0
  151. package/dist/core/forge_actions/runtime/engine.d.ts +25 -0
  152. package/dist/core/forge_actions/runtime/engine.d.ts.map +1 -0
  153. package/dist/core/forge_actions/runtime/engine.js +28 -0
  154. package/dist/core/forge_actions/runtime/engine.js.map +1 -0
  155. package/dist/core/forge_actions/runtime/job/execute.d.ts +19 -0
  156. package/dist/core/forge_actions/runtime/job/execute.d.ts.map +1 -0
  157. package/dist/core/forge_actions/runtime/job/execute.js +191 -0
  158. package/dist/core/forge_actions/runtime/job/execute.js.map +1 -0
  159. package/dist/core/forge_actions/runtime/job/step/execute.d.ts +7 -0
  160. package/dist/core/forge_actions/runtime/job/step/execute.d.ts.map +1 -0
  161. package/dist/core/forge_actions/runtime/job/step/execute.js +176 -0
  162. package/dist/core/forge_actions/runtime/job/step/execute.js.map +1 -0
  163. package/dist/core/forge_actions/runtime/queue.d.ts +11 -0
  164. package/dist/core/forge_actions/runtime/queue.d.ts.map +1 -0
  165. package/dist/core/forge_actions/runtime/queue.js +144 -0
  166. package/dist/core/forge_actions/runtime/queue.js.map +1 -0
  167. package/dist/core/forge_actions/runtime/run/execute.d.ts +9 -0
  168. package/dist/core/forge_actions/runtime/run/execute.d.ts.map +1 -0
  169. package/dist/core/forge_actions/runtime/run/execute.js +191 -0
  170. package/dist/core/forge_actions/runtime/run/execute.js.map +1 -0
  171. package/dist/core/forge_actions/runtime/types.d.ts +24 -0
  172. package/dist/core/forge_actions/runtime/types.d.ts.map +1 -0
  173. package/dist/core/forge_actions/runtime/types.js +2 -0
  174. package/dist/core/forge_actions/runtime/types.js.map +1 -0
  175. package/dist/core/forge_actions/runtime_support.d.ts +57 -0
  176. package/dist/core/forge_actions/runtime_support.d.ts.map +1 -0
  177. package/dist/core/forge_actions/runtime_support.js +276 -0
  178. package/dist/core/forge_actions/runtime_support.js.map +1 -0
  179. package/dist/core/forge_actions/shared.d.ts +92 -0
  180. package/dist/core/forge_actions/shared.d.ts.map +1 -0
  181. package/dist/core/forge_actions/shared.js +204 -0
  182. package/dist/core/forge_actions/shared.js.map +1 -0
  183. package/dist/core/forge_actions.d.ts +17 -24
  184. package/dist/core/forge_actions.d.ts.map +1 -1
  185. package/dist/core/forge_actions.js +33 -1459
  186. package/dist/core/forge_actions.js.map +1 -1
  187. package/dist/core/git_forge/storage_memory/actions.d.ts +5 -0
  188. package/dist/core/git_forge/storage_memory/actions.d.ts.map +1 -0
  189. package/dist/core/git_forge/storage_memory/actions.js +155 -0
  190. package/dist/core/git_forge/storage_memory/actions.js.map +1 -0
  191. package/dist/core/git_forge/storage_memory/adapter.d.ts +4 -0
  192. package/dist/core/git_forge/storage_memory/adapter.d.ts.map +1 -0
  193. package/dist/core/git_forge/storage_memory/adapter.js +118 -0
  194. package/dist/core/git_forge/storage_memory/adapter.js.map +1 -0
  195. package/dist/core/git_forge/storage_memory/state.d.ts +27 -0
  196. package/dist/core/git_forge/storage_memory/state.d.ts.map +1 -0
  197. package/dist/core/git_forge/storage_memory/state.js +53 -0
  198. package/dist/core/git_forge/storage_memory/state.js.map +1 -0
  199. package/dist/core/git_forge/storage_memory.d.ts +1 -3
  200. package/dist/core/git_forge/storage_memory.d.ts.map +1 -1
  201. package/dist/core/git_forge/storage_memory.js +1 -352
  202. package/dist/core/git_forge/storage_memory.js.map +1 -1
  203. package/dist/core/inspect/history.d.ts +13 -0
  204. package/dist/core/inspect/history.d.ts.map +1 -0
  205. package/dist/core/inspect/history.js +176 -0
  206. package/dist/core/inspect/history.js.map +1 -0
  207. package/dist/core/inspect/linguist.d.ts +12 -0
  208. package/dist/core/inspect/linguist.d.ts.map +1 -0
  209. package/dist/core/inspect/linguist.js +128 -0
  210. package/dist/core/inspect/linguist.js.map +1 -0
  211. package/dist/core/inspect/search_archive.d.ts +16 -0
  212. package/dist/core/inspect/search_archive.d.ts.map +1 -0
  213. package/dist/core/inspect/search_archive.js +88 -0
  214. package/dist/core/inspect/search_archive.js.map +1 -0
  215. package/dist/core/inspect/shared.d.ts +5 -0
  216. package/dist/core/inspect/shared.d.ts.map +1 -0
  217. package/dist/core/inspect/shared.js +47 -0
  218. package/dist/core/inspect/shared.js.map +1 -0
  219. package/dist/core/inspect/tree_blob.d.ts +16 -0
  220. package/dist/core/inspect/tree_blob.d.ts.map +1 -0
  221. package/dist/core/inspect/tree_blob.js +80 -0
  222. package/dist/core/inspect/tree_blob.js.map +1 -0
  223. package/dist/core/inspect.d.ts +3 -46
  224. package/dist/core/inspect.d.ts.map +1 -1
  225. package/dist/core/inspect.js +3 -546
  226. package/dist/core/inspect.js.map +1 -1
  227. package/dist/core/inspection/analysis.d.ts +4 -0
  228. package/dist/core/inspection/analysis.d.ts.map +1 -0
  229. package/dist/core/inspection/analysis.js +25 -0
  230. package/dist/core/inspection/analysis.js.map +1 -0
  231. package/dist/core/inspection/shared.d.ts +18 -0
  232. package/dist/core/inspection/shared.d.ts.map +1 -0
  233. package/dist/core/inspection/shared.js +112 -0
  234. package/dist/core/inspection/shared.js.map +1 -0
  235. package/dist/core/inspection/snapshots.d.ts +6 -0
  236. package/dist/core/inspection/snapshots.d.ts.map +1 -0
  237. package/dist/core/inspection/snapshots.js +270 -0
  238. package/dist/core/inspection/snapshots.js.map +1 -0
  239. package/dist/core/inspection/target.d.ts +4 -0
  240. package/dist/core/inspection/target.d.ts.map +1 -0
  241. package/dist/core/inspection/target.js +97 -0
  242. package/dist/core/inspection/target.js.map +1 -0
  243. package/dist/core/inspection/tree.d.ts +6 -0
  244. package/dist/core/inspection/tree.d.ts.map +1 -0
  245. package/dist/core/inspection/tree.js +103 -0
  246. package/dist/core/inspection/tree.js.map +1 -0
  247. package/dist/core/inspection.d.ts +6 -10
  248. package/dist/core/inspection.d.ts.map +1 -1
  249. package/dist/core/inspection.js +6 -592
  250. package/dist/core/inspection.js.map +1 -1
  251. package/dist/http/handler.d.ts.map +1 -1
  252. package/dist/http/handler.js +157 -133
  253. package/dist/http/handler.js.map +1 -1
  254. package/dist/index.d.ts +2 -1
  255. package/dist/index.d.ts.map +1 -1
  256. package/dist/index.js +1 -0
  257. package/dist/index.js.map +1 -1
  258. package/dist/ssh/server.d.ts.map +1 -1
  259. package/dist/ssh/server.js +171 -243
  260. package/dist/ssh/server.js.map +1 -1
  261. package/dist/types/forge/workflows/actions.d.ts +70 -0
  262. package/dist/types/forge/workflows/actions.d.ts.map +1 -0
  263. package/dist/types/forge/workflows/actions.js +3 -0
  264. package/dist/types/forge/workflows/actions.js.map +1 -0
  265. package/dist/types/forge/workflows/definition.d.ts +115 -0
  266. package/dist/types/forge/workflows/definition.d.ts.map +1 -0
  267. package/dist/types/forge/workflows/definition.js +2 -0
  268. package/dist/types/forge/workflows/definition.js.map +1 -0
  269. package/dist/types/forge/workflows/runs.d.ts +184 -0
  270. package/dist/types/forge/workflows/runs.d.ts.map +1 -0
  271. package/dist/types/forge/workflows/runs.js +2 -0
  272. package/dist/types/forge/workflows/runs.js.map +1 -0
  273. package/dist/types/forge/workflows.d.ts +3 -331
  274. package/dist/types/forge/workflows.d.ts.map +1 -1
  275. package/dist/types/index.d.ts +1 -1
  276. package/dist/types/index.d.ts.map +1 -1
  277. package/{bin → native}/git-host-actions-runner-darwin-arm64 +0 -0
  278. package/{bin → native}/git-host-actions-runner-darwin-x64 +0 -0
  279. package/{bin → native}/git-host-actions-runner-linux-arm64-gnu +0 -0
  280. package/{bin → native}/git-host-actions-runner-linux-x64-gnu +0 -0
  281. package/package.json +63 -11
  282. package/dist/frontend/js/utils/text.d.ts +0 -2
  283. package/dist/frontend/js/utils/text.d.ts.map +0 -1
  284. package/dist/frontend/js/utils/text.js +0 -4
  285. package/dist/frontend/js/utils/text.js.map +0 -1
  286. /package/{bin → native}/.gitkeep +0 -0
@@ -0,0 +1,62 @@
1
+ import path from "node:path";
2
+ import { GitHostError } from "../../../errors.js";
3
+ import { text } from "../../../utils/text.js";
4
+ import { publishReleaseAsset } from "../../actions/release_assets.js";
5
+ import { resolveReleaseAssetsRoot } from "../../actions/workspace.js";
6
+ import { resolveGithubRef } from "../shared.js";
7
+ function resolveReleaseAssetTag(run, stepWith) {
8
+ return text(stepWith.tag, text(resolveGithubRef(run)).replace(/^refs\/tags\//, "").replace(/^refs\/heads\//, ""));
9
+ }
10
+ async function emitPublishedReleaseAssetEvent(context, input) {
11
+ await context.emitRunEvent(input.run, {
12
+ job_id: input.jobRun.job_id,
13
+ job_name: input.jobRun.name,
14
+ job_run_id: input.jobRun.id,
15
+ metadata: {
16
+ asset_id: input.asset.id,
17
+ asset_name: input.asset.name,
18
+ release_id: input.release.id,
19
+ size: input.asset.size,
20
+ tag_name: input.release.tag_name,
21
+ },
22
+ status: "success",
23
+ step_id: input.stepRun.id,
24
+ step_index: input.stepRun.index,
25
+ step_name: input.stepRun.name,
26
+ summary: `Published release asset ${input.asset.name}.`,
27
+ type: "release_asset.published",
28
+ });
29
+ }
30
+ async function executePublishReleaseAssetStep(context, input) {
31
+ const assetName = text(input.stepWith.name);
32
+ const pathSpec = text(input.stepWith.path);
33
+ const format = text(input.stepWith.format, "tar.gz") === "zip" ? "zip" : "tar.gz";
34
+ if (!assetName || !pathSpec) {
35
+ throw new GitHostError("forge_actions_runner_failed", "actions/publish-release-asset requires with.name and with.path.", {
36
+ uses: input.stepRun.uses,
37
+ });
38
+ }
39
+ const tagName = resolveReleaseAssetTag(input.run, input.stepWith);
40
+ if (!tagName) {
41
+ throw new GitHostError("forge_actions_runner_failed", "actions/publish-release-asset could not resolve a tag name; pass with.tag explicitly.", {
42
+ uses: input.stepRun.uses,
43
+ });
44
+ }
45
+ const { asset, release } = await publishReleaseAsset({
46
+ assetName,
47
+ format,
48
+ releaseAssetsRoot: resolveReleaseAssetsRoot(context.options.actions),
49
+ releaseId: text(input.run.release_id) || undefined,
50
+ releases: context.options.releases,
51
+ repositoryId: input.run.repository_id,
52
+ sourcePath: path.resolve(input.workspacePath, pathSpec),
53
+ tagName,
54
+ });
55
+ await emitPublishedReleaseAssetEvent(context, { asset, jobRun: input.jobRun, release, run: input.run, stepRun: input.stepRun });
56
+ return {
57
+ outputPreview: `Published release asset ${asset.name} to release ${release.tag_name}.\n`,
58
+ summary: `Published release asset ${asset.name}.`,
59
+ };
60
+ }
61
+ export { executePublishReleaseAssetStep };
62
+ //# sourceMappingURL=release_asset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release_asset.js","sourceRoot":"","sources":["../../../../src/core/forge_actions/job/release_asset.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAO7C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAUjD,SAAS,sBAAsB,CAAC,GAAwB,EAAE,QAAgC;IACxF,OAAO,IAAI,CACT,QAAQ,CAAC,GAAG,EACZ,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CACvF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,8BAA8B,CAAC,OAA4B,EAAE,KAM3E;IACC,MAAM,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,EAAE;QACpC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;QAC3B,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;QAC3B,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE;QAC3B,QAAQ,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;QACb,MAAM,IAAI,YAAY,CAAC,6BAA6B,EAAE,uFAAuF,EAAE;YAC7I,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI;SACzB,CAAC,CAAC;IACL,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,mBAAmB,CAAC;QACnD,SAAS;QACT,MAAM;QACN,iBAAiB,EAAE,wBAAwB,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QACpE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,SAAS;QAClD,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ;QAClC,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa;QACrC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,QAAQ,CAAC;QACvD,OAAO;KACR,CAAC,CAAC;IACH,MAAM,8BAA8B,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAChI,OAAO;QACL,aAAa,EAAE,2BAA2B,KAAK,CAAC,IAAI,eAAe,OAAO,CAAC,QAAQ,KAAK;QACxF,OAAO,EAAE,2BAA2B,KAAK,CAAC,IAAI,GAAG;KAClD,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { GitForgeActionsStorage, GitForgeWorkflowRun, GitForgeWorkflowRunJob, GitForgeWorkflowRunStep, GitForgeWorkflowRunStepStatus } from "../../../types.js";
2
+ type JobStepSupportContext = {
3
+ emitRunEvent: (run: GitForgeWorkflowRun, input: Omit<import("../../../types.js").GitForgeWorkflowRunEvent, "created_at" | "id" | "repository_id" | "run_id" | "sequence" | "workflow_id">) => Promise<GitForgeWorkflowRun["id"] extends string ? any : never>;
4
+ markQueuedStepsForJob: (runId: string, jobRunId: string, status: Extract<GitForgeWorkflowRunStepStatus, "cancelled" | "skipped">) => Promise<void>;
5
+ options: import("../shared.js").CreateGitForgeActionsRuntimeOptions;
6
+ runner: ReturnType<typeof import("../shared.js").normalizeRunner>;
7
+ storage: GitForgeActionsStorage;
8
+ updateJob: (runId: string, jobRunId: string, input: Parameters<GitForgeActionsStorage["updateWorkflowRunJob"]>[2]) => Promise<GitForgeWorkflowRunJob>;
9
+ updateStep: (runId: string, stepId: string, input: Parameters<GitForgeActionsStorage["updateWorkflowRunStep"]>[2]) => Promise<GitForgeWorkflowRunStep>;
10
+ };
11
+ declare function createJobStepSupport(context: JobStepSupportContext): {
12
+ assertJobRunnerSupported: (jobRun: GitForgeWorkflowRunJob) => void;
13
+ cancelJob: (run: GitForgeWorkflowRun, jobRun: GitForgeWorkflowRunJob, summary: string) => Promise<GitForgeWorkflowRunJob>;
14
+ emitJobFinished: (run: GitForgeWorkflowRun, jobRun: GitForgeWorkflowRunJob) => Promise<void>;
15
+ emitJobStarted: (run: GitForgeWorkflowRun, jobRun: GitForgeWorkflowRunJob) => Promise<void>;
16
+ executeUsesStep: (input: {
17
+ artifactsRoot: string;
18
+ execution: import("../shared.js").ResolvedExecutionContext;
19
+ jobRun: GitForgeWorkflowRunJob;
20
+ run: GitForgeWorkflowRun;
21
+ stepWith: Record<string, string>;
22
+ stepRun: GitForgeWorkflowRunStep;
23
+ workspacePath: string;
24
+ }) => Promise<{
25
+ outputPreview: string;
26
+ summary: string;
27
+ }>;
28
+ finishStep: (run: GitForgeWorkflowRun, jobRun: GitForgeWorkflowRunJob, stepRun: GitForgeWorkflowRunStep, input: {
29
+ exitCode?: number | null;
30
+ outputPreview?: string;
31
+ status: GitForgeWorkflowRunStepStatus;
32
+ summary: string;
33
+ }) => Promise<GitForgeWorkflowRunStep>;
34
+ skipJob: (run: GitForgeWorkflowRun, jobRun: GitForgeWorkflowRunJob, summary: string) => Promise<GitForgeWorkflowRunJob>;
35
+ };
36
+ export { createJobStepSupport };
37
+ //# sourceMappingURL=steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../../src/core/forge_actions/job/steps.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,eAAe,CAAC;AAOvB,KAAK,qBAAqB,GAAG;IAC3B,YAAY,EAAE,CACZ,GAAG,EAAE,mBAAmB,EACxB,KAAK,EAAE,IAAI,CAAC,OAAO,eAAe,EAAE,wBAAwB,EAAE,YAAY,GAAG,IAAI,GAAG,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAC,KACzI,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;IACrE,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,6BAA6B,EAAE,WAAW,GAAG,SAAS,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnJ,OAAO,EAAE,OAAO,eAAe,EAAE,mCAAmC,CAAC;IACrE,MAAM,EAAE,UAAU,CAAC,cAAc,eAAe,EAAE,eAAe,CAAC,CAAC;IACnE,OAAO,EAAE,sBAAsB,CAAC;IAChC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACtJ,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,sBAAsB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACxJ,CAAC;AAwQF,iBAAS,oBAAoB,CAAC,OAAO,EAAE,qBAAqB;uCAIrB,sBAAsB;qBAvKxC,mBAAmB,UAAU,sBAAsB,WAAW,MAAM;2BAlEpE,mBAAmB,UAAU,sBAAsB;0BAfnD,mBAAmB,UAAU,sBAAsB;6BA8FjD;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,OAAO,eAAe,EAAE,wBAAwB,CAAC;QAC5D,MAAM,EAAE,sBAAsB,CAAC;QAC/B,GAAG,EAAE,mBAAmB,CAAC;QACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,EAAE,uBAAuB,CAAC;QACjC,aAAa,EAAE,MAAM,CAAC;KACvB;;;;sBAtEM,mBAAmB,UAChB,sBAAsB,WACrB,uBAAuB,SACzB;QACL,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,6BAA6B,CAAC;QACtC,OAAO,EAAE,MAAM,CAAC;KACjB;mBA4BgB,mBAAmB,UAAU,sBAAsB,WAAW,MAAM;EA4LxF;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,228 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { GitHostError } from "../../../errors.js";
3
+ import { text } from "../../../utils/text.js";
4
+ import { downloadArtifact, uploadArtifact } from "../../actions/artifacts.js";
5
+ import { setupRuntime } from "../../actions/local_runner.js";
6
+ import { executePublishReleaseAssetStep } from "./release_asset.js";
7
+ import { nowIso, resolveGithubRef } from "../shared.js";
8
+ function supportedRunnerLabels(runner) {
9
+ return new Set(runner.labels || []);
10
+ }
11
+ function assertJobRunnerSupported(runner, jobRun) {
12
+ const labels = supportedRunnerLabels(runner);
13
+ const unsupported = jobRun.runs_on.filter((entry) => !labels.has(text(entry)));
14
+ if (unsupported.length) {
15
+ throw new GitHostError("forge_actions_runner_failed", `Job "${jobRun.name}" requested unsupported runner labels: ${unsupported.join(", ")}.`, {
16
+ jobRunId: jobRun.id,
17
+ labels: unsupported,
18
+ });
19
+ }
20
+ }
21
+ function createEmitJobStarted(emitRunEvent) {
22
+ return async (run, jobRun) => {
23
+ await emitRunEvent(run, {
24
+ job_id: jobRun.job_id,
25
+ job_name: jobRun.name,
26
+ job_run_id: jobRun.id,
27
+ status: "running",
28
+ summary: `Running job ${jobRun.name}.`,
29
+ type: "job.started",
30
+ });
31
+ };
32
+ }
33
+ function createEmitJobFinished(emitRunEvent) {
34
+ return async (run, jobRun) => {
35
+ await emitRunEvent(run, {
36
+ job_id: jobRun.job_id,
37
+ job_name: jobRun.name,
38
+ job_run_id: jobRun.id,
39
+ status: jobRun.status,
40
+ summary: jobRun.summary,
41
+ type: "job.finished",
42
+ });
43
+ };
44
+ }
45
+ function createFinishStep(updateStep, emitRunEvent) {
46
+ return async (run, jobRun, stepRun, input) => {
47
+ const finished = await updateStep(run.id, stepRun.id, {
48
+ exit_code: input.exitCode === undefined ? stepRun.exit_code : input.exitCode,
49
+ finished_at: nowIso(),
50
+ output_preview: text(input.outputPreview, stepRun.output_preview),
51
+ status: input.status,
52
+ });
53
+ await emitRunEvent(run, {
54
+ command: finished.command,
55
+ job_id: jobRun.job_id,
56
+ job_name: jobRun.name,
57
+ job_run_id: jobRun.id,
58
+ metadata: {
59
+ exit_code: finished.exit_code,
60
+ },
61
+ status: finished.status,
62
+ step_id: finished.id,
63
+ step_index: finished.index,
64
+ step_name: finished.name,
65
+ summary: input.summary,
66
+ type: "step.finished",
67
+ });
68
+ return finished;
69
+ };
70
+ }
71
+ function createSkipJob(context, emitJobFinished) {
72
+ return async (run, jobRun, summary) => {
73
+ await context.markQueuedStepsForJob(run.id, jobRun.id, "skipped");
74
+ const finished = await context.updateJob(run.id, jobRun.id, {
75
+ finished_at: nowIso(),
76
+ status: "skipped",
77
+ summary,
78
+ });
79
+ await emitJobFinished(run, finished);
80
+ return finished;
81
+ };
82
+ }
83
+ function createCancelJob(context, emitJobFinished) {
84
+ return async (run, jobRun, summary) => {
85
+ await context.markQueuedStepsForJob(run.id, jobRun.id, "cancelled");
86
+ const finished = await context.updateJob(run.id, jobRun.id, {
87
+ finished_at: nowIso(),
88
+ status: "cancelled",
89
+ summary,
90
+ });
91
+ await emitJobFinished(run, finished);
92
+ return finished;
93
+ };
94
+ }
95
+ function createUsesDispatcher(context) {
96
+ return async (input) => {
97
+ const uses = text(input.stepRun.uses);
98
+ if (uses === "actions/checkout" || uses === "actions/checkout@v4")
99
+ return executeCheckoutStep(input);
100
+ if (uses === "actions/setup-node" || uses === "actions/setup-node@v4")
101
+ return await executeRuntimeSetup("node", input.workspacePath);
102
+ if (uses === "oven-sh/setup-bun" || uses === "oven-sh/setup-bun@v2")
103
+ return await executeRuntimeSetup("bun", input.workspacePath);
104
+ if (uses === "actions/upload-artifact" || uses === "actions/upload-artifact@v4")
105
+ return await executeUploadArtifactStep(context, input, uses);
106
+ if (uses === "actions/download-artifact" || uses === "actions/download-artifact@v4")
107
+ return await executeDownloadArtifactStep(context, input, uses);
108
+ if (uses === "actions/publish-release-asset" || uses === "actions/publish-release-asset@v1")
109
+ return await executePublishReleaseAssetStep(context, input);
110
+ throw new GitHostError("forge_actions_runner_failed", `Unsupported action "${uses}".`, { uses });
111
+ };
112
+ }
113
+ function executeCheckoutStep(input) {
114
+ const targetRef = text(input.stepWith.ref);
115
+ const targetPath = text(input.stepWith.path, ".");
116
+ if (targetRef && targetRef !== input.run.ref && targetRef !== resolveGithubRef(input.run)) {
117
+ throw new GitHostError("forge_actions_runner_failed", "actions/checkout only supports the workflow snapshot ref in v1.", {
118
+ requestedRef: targetRef,
119
+ runRef: input.run.ref,
120
+ });
121
+ }
122
+ if (targetPath && targetPath !== ".") {
123
+ throw new GitHostError("forge_actions_runner_failed", "actions/checkout path overrides are not supported in v1.", {
124
+ path: targetPath,
125
+ });
126
+ }
127
+ return {
128
+ outputPreview: "Checked out workflow snapshot.\n",
129
+ summary: "Checked out workflow snapshot.",
130
+ };
131
+ }
132
+ async function executeRuntimeSetup(kind, workspacePath) {
133
+ const version = await setupRuntime(kind, workspacePath);
134
+ return {
135
+ outputPreview: text(version.stdout, version.stderr),
136
+ summary: `${kind === "node" ? "Node" : "Bun"} runtime is available.`,
137
+ };
138
+ }
139
+ async function executeUploadArtifactStep(context, input, uses) {
140
+ const artifactName = text(input.stepWith.name);
141
+ const pathSpec = text(input.stepWith.path);
142
+ if (!artifactName || !pathSpec) {
143
+ throw new GitHostError("forge_actions_runner_failed", "actions/upload-artifact requires with.name and with.path.", { uses });
144
+ }
145
+ const stored = uploadArtifact({ artifactName, artifactsRoot: input.artifactsRoot, pathSpec, workspacePath: input.workspacePath });
146
+ const artifact = await context.storage.createWorkflowRunArtifact({
147
+ created_at: nowIso(),
148
+ file_count: stored.fileCount,
149
+ id: randomUUID(),
150
+ job_run_id: input.jobRun.id,
151
+ name: artifactName,
152
+ path: stored.path,
153
+ repository_id: input.run.repository_id,
154
+ run_id: input.run.id,
155
+ size: stored.size,
156
+ step_id: input.stepRun.id,
157
+ });
158
+ await context.emitRunEvent(input.run, {
159
+ artifact_id: artifact.id,
160
+ artifact_name: artifact.name,
161
+ job_id: input.jobRun.job_id,
162
+ job_name: input.jobRun.name,
163
+ job_run_id: input.jobRun.id,
164
+ metadata: { file_count: artifact.file_count, size: artifact.size },
165
+ status: "success",
166
+ step_id: input.stepRun.id,
167
+ step_index: input.stepRun.index,
168
+ step_name: input.stepRun.name,
169
+ summary: `Uploaded artifact ${artifact.name}.`,
170
+ type: "artifact.uploaded",
171
+ });
172
+ return {
173
+ outputPreview: `Uploaded artifact ${artifactName} (${stored.fileCount} files).\n`,
174
+ summary: `Uploaded artifact ${artifactName}.`,
175
+ };
176
+ }
177
+ async function executeDownloadArtifactStep(context, input, uses) {
178
+ const artifactName = text(input.stepWith.name);
179
+ if (!artifactName) {
180
+ throw new GitHostError("forge_actions_runner_failed", "actions/download-artifact requires with.name.", { uses });
181
+ }
182
+ const artifacts = await context.storage.listWorkflowRunArtifacts(input.run.id, { name: artifactName });
183
+ const artifact = artifacts[0];
184
+ if (!artifact) {
185
+ throw new GitHostError("forge_actions_runner_failed", `Artifact "${artifactName}" was not found for this run.`, {
186
+ artifactName,
187
+ runId: input.run.id,
188
+ });
189
+ }
190
+ downloadArtifact({
191
+ artifact,
192
+ artifactsRoot: input.artifactsRoot,
193
+ destinationPath: text(input.stepWith.path, "."),
194
+ workspacePath: input.workspacePath,
195
+ });
196
+ await context.emitRunEvent(input.run, {
197
+ artifact_id: artifact.id,
198
+ artifact_name: artifact.name,
199
+ job_id: input.jobRun.job_id,
200
+ job_name: input.jobRun.name,
201
+ job_run_id: input.jobRun.id,
202
+ status: "success",
203
+ step_id: input.stepRun.id,
204
+ step_index: input.stepRun.index,
205
+ step_name: input.stepRun.name,
206
+ summary: `Downloaded artifact ${artifact.name}.`,
207
+ type: "artifact.downloaded",
208
+ });
209
+ return {
210
+ outputPreview: `Downloaded artifact ${artifactName}.\n`,
211
+ summary: `Downloaded artifact ${artifactName}.`,
212
+ };
213
+ }
214
+ function createJobStepSupport(context) {
215
+ const emitJobStarted = createEmitJobStarted(context.emitRunEvent);
216
+ const emitJobFinished = createEmitJobFinished(context.emitRunEvent);
217
+ return {
218
+ assertJobRunnerSupported: (jobRun) => assertJobRunnerSupported(context.runner, jobRun),
219
+ cancelJob: createCancelJob(context, emitJobFinished),
220
+ emitJobFinished,
221
+ emitJobStarted,
222
+ executeUsesStep: createUsesDispatcher(context),
223
+ finishStep: createFinishStep(context.updateStep, context.emitRunEvent),
224
+ skipJob: createSkipJob(context, emitJobFinished),
225
+ };
226
+ }
227
+ export { createJobStepSupport };
228
+ //# sourceMappingURL=steps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.js","sourceRoot":"","sources":["../../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CAAC;QACtE,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,eAAe,CAAC;KACjD,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { CreateGitForgeOptions, GitForgeActor, RunGitForgeWorkflowInput } from "../../../types.js";
2
+ import type { QueueWorkflowRun, RuntimeContext } from "./types.js";
3
+ declare function createRuntimeApi(context: RuntimeContext, queueWorkflowRun: QueueWorkflowRun): {
4
+ runWorkflow(repositoryId: string, workflowId: string, input: RunGitForgeWorkflowInput): Promise<import("../../../types.js").GitForgeWorkflowRun>;
5
+ cancelWorkflowRun: (repositoryId: string, runId: string, actor: GitForgeActor) => Promise<import("../../../types.js").GitForgeWorkflowRun>;
6
+ subscribeWorkflowRun(repositoryId: string, runId: string, listener: import("../shared.js").WorkflowRunListener): {
7
+ close(): void;
8
+ };
9
+ listWorkflows(repositoryId: string, filters?: import("../../../types.js").GitForgeWorkflowFilters): Promise<import("../../../types.js").GitForgeWorkflow[]>;
10
+ readWorkflow(repositoryId: string, workflowId: string): Promise<import("../../../types.js").GitForgeWorkflow>;
11
+ listWorkflowRuns(repositoryId: string, filters?: import("../../../types.js").GitForgeWorkflowRunFilters): Promise<import("../../../types.js").GitForgeWorkflowRun[]>;
12
+ readWorkflowRun(repositoryId: string, runId: string): Promise<import("../../../types.js").GitForgeWorkflowRun>;
13
+ listWorkflowRunJobs(repositoryId: string, runId: string, filters?: {
14
+ jobId?: string;
15
+ status?: import("../../../types.js").GitForgeWorkflowRunJobStatus | import("../../../types.js").GitForgeWorkflowRunJobStatus[];
16
+ }): Promise<import("../../../types.js").GitForgeWorkflowRunJob[]>;
17
+ listWorkflowRunSteps(repositoryId: string, runId: string, filters?: import("../../../types.js").GitForgeWorkflowRunStepFilters): Promise<import("../../../types.js").GitForgeWorkflowRunStep[]>;
18
+ listWorkflowRunArtifacts(repositoryId: string, runId: string, filters?: {
19
+ jobRunId?: string;
20
+ name?: string;
21
+ }): Promise<import("../../../types.js").GitForgeWorkflowRunArtifact[]>;
22
+ listWorkflowRunEvents(repositoryId: string, runId: string, filters?: import("../../../types.js").GitForgeWorkflowRunEventFilters): Promise<import("../../../types.js").GitForgeWorkflowRunEvent[]>;
23
+ bindActivityStorage: (activityStorage: CreateGitForgeOptions["storage"]["activity"]) => void;
24
+ };
25
+ export { createRuntimeApi };
26
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/core/forge_actions/runtime/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EAErB,aAAa,EACb,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAUvB,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACf,MAAM,YAAY,CAAC;AAwNpB,iBAAS,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB;8BArCjD,MAAM,cAAc,MAAM,SAAS,wBAAwB;sCA5EjE,MAAM,SAAS,MAAM,SAAS,aAAa;uCA6FlC,MAAM,SAAS,MAAM,YAAY,OAAO,eAAe,EAAE,mBAAmB;;;gCAzD7E,MAAM,YAAY,OAAO,eAAe,EAAE,uBAAuB;+BAKlE,MAAM,cAAc,MAAM;mCAItB,MAAM,YAAY,OAAO,eAAe,EAAE,0BAA0B;kCAGrE,MAAM,SAAS,MAAM;sCAGjB,MAAM,SAAS,MAAM,YAAY;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,eAAe,EAAE,4BAA4B,GAAG,OAAO,eAAe,EAAE,4BAA4B,EAAE,CAAA;KAAE;uCAI1K,MAAM,SAAS,MAAM,YAAY,OAAO,eAAe,EAAE,8BAA8B;2CAInF,MAAM,SAAS,MAAM,YAAY;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;wCAIxE,MAAM,SAAS,MAAM,YAAY,OAAO,eAAe,EAAE,+BAA+B;2CAnG3G,qBAAqB,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC;EA4JtE;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,210 @@
1
+ import { GitHostError } from "../../../errors.js";
2
+ import { text } from "../../../utils/text.js";
3
+ import { listRepositoryWorkflows, matchesWorkflowTrigger, resolveRepositoryWorkflowRoot } from "../../actions/workflows.js";
4
+ import { ACTIVITY_LISTENER_SYMBOL, ACTIVITY_WRAPPED_SYMBOL, isTerminalRunStatus, nowIso, } from "../shared.js";
5
+ function createActor(entry) {
6
+ return {
7
+ id: text(entry.actor_id, text(entry.actor_label, "system")),
8
+ name: text(entry.actor_label, entry.actor_id),
9
+ };
10
+ }
11
+ async function enqueueWorkflowsForTrigger(context, queueWorkflowRun, repositoryId, triggerKind, actor, triggerContext) {
12
+ const target = await context.runtimeSupport.resolveRunTarget(repositoryId, {
13
+ branch: text(triggerContext.branch),
14
+ commitHash: text(triggerContext.commit_hash, text(triggerContext.head_commit)),
15
+ ref: text(triggerContext.ref, text(triggerContext.tag_name, text(triggerContext.branch, "HEAD"))),
16
+ });
17
+ const workflowRoot = await resolveRepositoryWorkflowRoot(context.options.actions, repositoryId);
18
+ const workflows = await listRepositoryWorkflows({
19
+ filters: { enabled: true },
20
+ ref: target.ref,
21
+ repositoryId,
22
+ repositoryPath: target.repositoryPath,
23
+ workflowRoot,
24
+ });
25
+ const createdRuns = [];
26
+ for (const workflow of workflows) {
27
+ if (!matchesWorkflowTrigger(workflow, triggerKind, triggerContext))
28
+ continue;
29
+ createdRuns.push(await queueWorkflowRun(repositoryId, workflow, {
30
+ actor,
31
+ branch: target.branch || undefined,
32
+ commitHash: target.commitHash,
33
+ ref: target.ref,
34
+ triggerContext,
35
+ triggerKind,
36
+ }));
37
+ }
38
+ return createdRuns;
39
+ }
40
+ async function handleReleaseActivity(context, queueWorkflowRun, entry, actor) {
41
+ const releaseId = text(entry.metadata?.release_id);
42
+ const release = releaseId ? await context.options.releases.readRelease(entry.repository_id, releaseId) : null;
43
+ const targetRef = text(release?.target_ref);
44
+ const repositoryPath = await context.runtimeSupport.readRepositoryPath(entry.repository_id);
45
+ const commitHash = targetRef ? await context.runtimeSupport.resolveCommit(repositoryPath, targetRef) : "";
46
+ await enqueueWorkflowsForTrigger(context, queueWorkflowRun, entry.repository_id, entry.kind, actor, {
47
+ ...(entry.metadata || {}),
48
+ activity_id: entry.id,
49
+ commit_hash: commitHash,
50
+ ref: text(release?.tag_name, targetRef),
51
+ release_id: release?.id,
52
+ tag_name: text(release?.tag_name, text(entry.metadata?.tag_name)),
53
+ });
54
+ }
55
+ function createBindActivityStorage(context, queueWorkflowRun) {
56
+ return (activityStorage) => {
57
+ const store = activityStorage;
58
+ if (!store[ACTIVITY_LISTENER_SYMBOL])
59
+ store[ACTIVITY_LISTENER_SYMBOL] = new Set();
60
+ store[ACTIVITY_LISTENER_SYMBOL].add(async (entry) => {
61
+ const actor = createActor(entry);
62
+ if (entry.kind === "repository.push") {
63
+ await enqueueWorkflowsForTrigger(context, queueWorkflowRun, entry.repository_id, "push", actor, {
64
+ ...(entry.metadata || {}),
65
+ activity_id: entry.id,
66
+ });
67
+ return;
68
+ }
69
+ if (entry.kind === "release.create" || entry.kind === "release.update") {
70
+ await handleReleaseActivity(context, queueWorkflowRun, entry, actor);
71
+ }
72
+ });
73
+ if (store[ACTIVITY_WRAPPED_SYMBOL])
74
+ return;
75
+ store[ACTIVITY_WRAPPED_SYMBOL] = true;
76
+ const original = activityStorage.createActivity.bind(activityStorage);
77
+ activityStorage.createActivity = async (input) => {
78
+ const entry = await original(input);
79
+ const listeners = Array.from(store[ACTIVITY_LISTENER_SYMBOL] || []);
80
+ await Promise.all(listeners.map(async (listener) => {
81
+ try {
82
+ await listener(entry);
83
+ }
84
+ catch { }
85
+ }));
86
+ return entry;
87
+ };
88
+ };
89
+ }
90
+ function createCancelWorkflowRun(context) {
91
+ return async (repositoryId, runId, actor) => {
92
+ const run = await context.runtimeSupport.readRequiredRun(repositoryId, runId);
93
+ if (isTerminalRunStatus(run.status))
94
+ return run;
95
+ const active = context.activeRuns.get(run.id);
96
+ await context.runtimeSupport.emitRunEvent(run, {
97
+ metadata: { actor_id: actor.id },
98
+ status: "running",
99
+ summary: `Cancellation requested by ${text(actor.id)}.`,
100
+ type: "run.cancellation_requested",
101
+ });
102
+ if (active) {
103
+ active.cancelRequested = true;
104
+ if (active.child && !active.child.killed) {
105
+ try {
106
+ active.child.kill("SIGTERM");
107
+ }
108
+ catch { }
109
+ }
110
+ return await context.runtimeSupport.updateRun(repositoryId, runId, {
111
+ summary: `Cancellation requested by ${text(actor.id)}.`,
112
+ });
113
+ }
114
+ await context.runtimeSupport.markQueuedJobsAndSteps(run.id, "cancelled");
115
+ const cancelled = await context.runtimeSupport.updateRun(repositoryId, runId, {
116
+ finished_at: nowIso(),
117
+ status: "cancelled",
118
+ summary: `Cancelled by ${text(actor.id)}.`,
119
+ });
120
+ await context.runtimeSupport.emitRunEvent(cancelled, {
121
+ status: "cancelled",
122
+ summary: cancelled.summary,
123
+ type: "run.cancelled",
124
+ });
125
+ return cancelled;
126
+ };
127
+ }
128
+ function createReadApi(context) {
129
+ return {
130
+ async listWorkflows(repositoryId, filters) {
131
+ const repositoryPath = await context.runtimeSupport.readRepositoryPath(repositoryId);
132
+ const workflowRoot = await resolveRepositoryWorkflowRoot(context.options.actions, repositoryId);
133
+ return await listRepositoryWorkflows({ filters, repositoryId, repositoryPath, workflowRoot });
134
+ },
135
+ async readWorkflow(repositoryId, workflowId) {
136
+ const repositoryPath = await context.runtimeSupport.readRepositoryPath(repositoryId);
137
+ return await context.runtimeSupport.readWorkflowAtRef(repositoryId, repositoryPath, undefined, workflowId);
138
+ },
139
+ async listWorkflowRuns(repositoryId, filters) {
140
+ return await context.storage.listWorkflowRuns(repositoryId, filters);
141
+ },
142
+ async readWorkflowRun(repositoryId, runId) {
143
+ return await context.runtimeSupport.readRequiredRun(repositoryId, runId);
144
+ },
145
+ async listWorkflowRunJobs(repositoryId, runId, filters) {
146
+ await context.runtimeSupport.readRequiredRun(repositoryId, runId);
147
+ return await context.storage.listWorkflowRunJobs(runId, filters);
148
+ },
149
+ async listWorkflowRunSteps(repositoryId, runId, filters) {
150
+ await context.runtimeSupport.readRequiredRun(repositoryId, runId);
151
+ return await context.storage.listWorkflowRunSteps(runId, filters);
152
+ },
153
+ async listWorkflowRunArtifacts(repositoryId, runId, filters) {
154
+ await context.runtimeSupport.readRequiredRun(repositoryId, runId);
155
+ return await context.storage.listWorkflowRunArtifacts(runId, filters);
156
+ },
157
+ async listWorkflowRunEvents(repositoryId, runId, filters) {
158
+ await context.runtimeSupport.readRequiredRun(repositoryId, runId);
159
+ return await context.storage.listWorkflowRunEvents(runId, filters);
160
+ },
161
+ };
162
+ }
163
+ function createRunApi(context, queueWorkflowRun, cancelWorkflowRun) {
164
+ return {
165
+ async runWorkflow(repositoryId, workflowId, input) {
166
+ const target = await context.runtimeSupport.resolveRunTarget(repositoryId, input);
167
+ const workflow = await context.runtimeSupport.readWorkflowAtRef(repositoryId, target.repositoryPath, target.ref, workflowId);
168
+ if (!workflow.on?.workflow_dispatch && workflow.trigger !== "manual") {
169
+ throw new GitHostError("forge_invalid_workflow_definition", `Workflow "${workflowId}" does not support manual dispatch.`, {
170
+ workflowId,
171
+ });
172
+ }
173
+ return await queueWorkflowRun(repositoryId, workflow, {
174
+ ...input,
175
+ branch: target.branch || undefined,
176
+ commitHash: target.commitHash,
177
+ ref: target.ref,
178
+ triggerKind: "manual",
179
+ });
180
+ },
181
+ cancelWorkflowRun,
182
+ subscribeWorkflowRun(repositoryId, runId, listener) {
183
+ void repositoryId;
184
+ let listeners = context.runListeners.get(runId);
185
+ if (!listeners) {
186
+ listeners = new Set();
187
+ context.runListeners.set(runId, listeners);
188
+ }
189
+ listeners.add(listener);
190
+ return {
191
+ close() {
192
+ listeners?.delete(listener);
193
+ if (listeners && listeners.size === 0) {
194
+ context.runListeners.delete(runId);
195
+ }
196
+ },
197
+ };
198
+ },
199
+ };
200
+ }
201
+ function createRuntimeApi(context, queueWorkflowRun) {
202
+ const cancelWorkflowRun = createCancelWorkflowRun(context);
203
+ return {
204
+ bindActivityStorage: createBindActivityStorage(context, queueWorkflowRun),
205
+ ...createReadApi(context),
206
+ ...createRunApi(context, queueWorkflowRun, cancelWorkflowRun),
207
+ };
208
+ }
209
+ export { createRuntimeApi };
210
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/core/forge_actions/runtime/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAO7C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAC/G,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,EACnB,MAAM,GACP,MAAM,eAAe,CAAC;AAMvB,SAAS,WAAW,CAAC,KAA4B;IAC/C,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAC3D,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,0BAA0B,CACvC,OAAuB,EACvB,gBAAkC,EAClC,YAAoB,EACpB,WAAgE,EAChE,KAAoB,EACpB,cAAuC;IAEvC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,gBAAgB,CAAC,YAAY,EAAE;QACzE,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;QACnC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,WAA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CAAC;wBACtC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBACrC,CAAC;gBACH,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAuB,EAAE,gBAAkC;IACnF,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC3D,OAAO;QACL,mBAAmB,EAAE,yBAAyB,CAAC,OAAO,EAAE,gBAAgB,CAAC;QACzE,GAAG,aAAa,CAAC,OAAO,CAAC;QACzB,GAAG,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,CAAC;KAC9D,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { RuntimeContext } from "./types.js";
2
+ declare function createRuntimeEngine(context: RuntimeContext): {
3
+ runWorkflow(repositoryId: string, workflowId: string, input: import("../../../types.js").RunGitForgeWorkflowInput): Promise<import("../../../types.js").GitForgeWorkflowRun>;
4
+ cancelWorkflowRun: (repositoryId: string, runId: string, actor: import("../../../types.js").GitForgeActor) => Promise<import("../../../types.js").GitForgeWorkflowRun>;
5
+ subscribeWorkflowRun(repositoryId: string, runId: string, listener: import("../shared.js").WorkflowRunListener): {
6
+ close(): void;
7
+ };
8
+ listWorkflows(repositoryId: string, filters?: import("../../../types.js").GitForgeWorkflowFilters): Promise<import("../../../types.js").GitForgeWorkflow[]>;
9
+ readWorkflow(repositoryId: string, workflowId: string): Promise<import("../../../types.js").GitForgeWorkflow>;
10
+ listWorkflowRuns(repositoryId: string, filters?: import("../../../types.js").GitForgeWorkflowRunFilters): Promise<import("../../../types.js").GitForgeWorkflowRun[]>;
11
+ readWorkflowRun(repositoryId: string, runId: string): Promise<import("../../../types.js").GitForgeWorkflowRun>;
12
+ listWorkflowRunJobs(repositoryId: string, runId: string, filters?: {
13
+ jobId?: string;
14
+ status?: import("../../../types.js").GitForgeWorkflowRunJobStatus | import("../../../types.js").GitForgeWorkflowRunJobStatus[];
15
+ }): Promise<import("../../../types.js").GitForgeWorkflowRunJob[]>;
16
+ listWorkflowRunSteps(repositoryId: string, runId: string, filters?: import("../../../types.js").GitForgeWorkflowRunStepFilters): Promise<import("../../../types.js").GitForgeWorkflowRunStep[]>;
17
+ listWorkflowRunArtifacts(repositoryId: string, runId: string, filters?: {
18
+ jobRunId?: string;
19
+ name?: string;
20
+ }): Promise<import("../../../types.js").GitForgeWorkflowRunArtifact[]>;
21
+ listWorkflowRunEvents(repositoryId: string, runId: string, filters?: import("../../../types.js").GitForgeWorkflowRunEventFilters): Promise<import("../../../types.js").GitForgeWorkflowRunEvent[]>;
22
+ bindActivityStorage: (activityStorage: import("../../../types.js").CreateGitForgeOptions["storage"]["activity"]) => void;
23
+ };
24
+ export { createRuntimeEngine };
25
+ //# sourceMappingURL=engine.d.ts.map