skuba 13.0.0-custom-conditions-exports-20250923055337 → 13.0.0-custom-conditions-exports-20251007055842

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 (170) hide show
  1. package/lib/cli/build/assets.js +3 -7
  2. package/lib/cli/build/assets.js.map +2 -2
  3. package/lib/cli/build/esbuild.d.ts +2 -1
  4. package/lib/cli/build/esbuild.js +4 -3
  5. package/lib/cli/build/esbuild.js.map +2 -2
  6. package/lib/cli/build/index.js +8 -4
  7. package/lib/cli/build/index.js.map +2 -2
  8. package/lib/cli/init/git.js +1 -1
  9. package/lib/cli/init/git.js.map +2 -2
  10. package/lib/cli/init/index.js +4 -4
  11. package/lib/cli/init/index.js.map +3 -3
  12. package/lib/cli/lint/annotate/buildkite/eslint.js +1 -1
  13. package/lib/cli/lint/annotate/buildkite/eslint.js.map +2 -2
  14. package/lib/cli/lint/annotate/buildkite/index.js +1 -1
  15. package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
  16. package/lib/cli/lint/annotate/buildkite/internal.js +1 -1
  17. package/lib/cli/lint/annotate/buildkite/internal.js.map +2 -2
  18. package/lib/cli/lint/annotate/buildkite/prettier.js +1 -1
  19. package/lib/cli/lint/annotate/buildkite/prettier.js.map +2 -2
  20. package/lib/cli/lint/annotate/buildkite/tsc.js +1 -1
  21. package/lib/cli/lint/annotate/buildkite/tsc.js.map +2 -2
  22. package/lib/cli/lint/annotate/github/eslint.d.ts +1 -1
  23. package/lib/cli/lint/annotate/github/eslint.js.map +2 -2
  24. package/lib/cli/lint/annotate/github/index.js +3 -4
  25. package/lib/cli/lint/annotate/github/index.js.map +2 -2
  26. package/lib/cli/lint/annotate/github/internal.d.ts +1 -1
  27. package/lib/cli/lint/annotate/github/internal.js.map +2 -2
  28. package/lib/cli/lint/annotate/github/prettier.d.ts +1 -1
  29. package/lib/cli/lint/annotate/github/prettier.js.map +2 -2
  30. package/lib/cli/lint/annotate/github/tsc.d.ts +1 -1
  31. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  32. package/lib/cli/lint/autofix.d.ts +1 -1
  33. package/lib/cli/lint/autofix.js +3 -3
  34. package/lib/cli/lint/autofix.js.map +2 -2
  35. package/lib/cli/lint/internalLints/patchRenovateConfig.js +1 -1
  36. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  37. package/lib/{api/buildkite → cli/lint/internalLints/upgrade/patches/12.3.0}/index.js +17 -9
  38. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +7 -0
  39. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +3 -0
  40. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +100 -0
  41. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +7 -0
  42. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +3 -0
  43. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +99 -0
  44. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +7 -0
  45. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +2 -0
  46. package/lib/{api/net → cli/lint/internalLints/upgrade/patches/12.4.0}/index.js +12 -6
  47. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +7 -0
  48. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +3 -0
  49. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +101 -0
  50. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +7 -0
  51. package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/configureTsConfigForESM.js +9 -7
  52. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/configureTsConfigForESM.js.map +7 -0
  53. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/index.d.ts +2 -0
  54. package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/index.js.map +1 -1
  55. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.d.ts +13 -0
  56. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.js +225 -0
  57. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.js.map +7 -0
  58. package/lib/cli/test/reporters/github/annotations.d.ts +1 -1
  59. package/lib/cli/test/reporters/github/annotations.js.map +1 -1
  60. package/lib/cli/test/reporters/github/index.js +3 -4
  61. package/lib/cli/test/reporters/github/index.js.map +2 -2
  62. package/lib/index.d.ts +4 -4
  63. package/lib/index.js +4 -4
  64. package/lib/index.js.map +2 -2
  65. package/lib/utils/dir.js +2 -2
  66. package/lib/utils/dir.js.map +3 -3
  67. package/lib/utils/manifest.d.ts +5 -1
  68. package/lib/utils/manifest.js +16 -7
  69. package/lib/utils/manifest.js.map +2 -2
  70. package/package.json +4 -3
  71. package/template/base/_pnpm-workspace.yaml +1 -0
  72. package/template/express-rest-api/Dockerfile +1 -1
  73. package/template/express-rest-api/Dockerfile.dev-deps +0 -2
  74. package/template/express-rest-api/package.json +1 -1
  75. package/template/greeter/Dockerfile +0 -2
  76. package/template/greeter/package.json +2 -2
  77. package/template/koa-rest-api/Dockerfile +1 -1
  78. package/template/koa-rest-api/Dockerfile.dev-deps +0 -2
  79. package/template/koa-rest-api/package.json +1 -1
  80. package/template/lambda-sqs-worker-cdk/Dockerfile +0 -2
  81. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
  82. package/template/lambda-sqs-worker-cdk/package.json +2 -2
  83. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  84. package/template/oss-npm-package/README.md +1 -1
  85. package/lib/api/buildkite/annotate.d.ts +0 -28
  86. package/lib/api/buildkite/annotate.js +0 -62
  87. package/lib/api/buildkite/annotate.js.map +0 -7
  88. package/lib/api/buildkite/index.d.ts +0 -3
  89. package/lib/api/buildkite/index.js.map +0 -7
  90. package/lib/api/buildkite/md.d.ts +0 -6
  91. package/lib/api/buildkite/md.js +0 -33
  92. package/lib/api/buildkite/md.js.map +0 -7
  93. package/lib/api/git/commit.d.ts +0 -15
  94. package/lib/api/git/commit.js +0 -52
  95. package/lib/api/git/commit.js.map +0 -7
  96. package/lib/api/git/commitAllChanges.d.ts +0 -19
  97. package/lib/api/git/commitAllChanges.js +0 -83
  98. package/lib/api/git/commitAllChanges.js.map +0 -7
  99. package/lib/api/git/currentBranch.d.ts +0 -10
  100. package/lib/api/git/currentBranch.js +0 -59
  101. package/lib/api/git/currentBranch.js.map +0 -7
  102. package/lib/api/git/findRoot.d.ts +0 -9
  103. package/lib/api/git/findRoot.js +0 -52
  104. package/lib/api/git/findRoot.js.map +0 -7
  105. package/lib/api/git/getChangedFiles.d.ts +0 -20
  106. package/lib/api/git/getChangedFiles.js +0 -81
  107. package/lib/api/git/getChangedFiles.js.map +0 -7
  108. package/lib/api/git/index.d.ts +0 -12
  109. package/lib/api/git/index.js +0 -61
  110. package/lib/api/git/index.js.map +0 -7
  111. package/lib/api/git/isFileGitIgnored.d.ts +0 -4
  112. package/lib/api/git/isFileGitIgnored.js +0 -49
  113. package/lib/api/git/isFileGitIgnored.js.map +0 -7
  114. package/lib/api/git/log.d.ts +0 -19
  115. package/lib/api/git/log.js +0 -71
  116. package/lib/api/git/log.js.map +0 -7
  117. package/lib/api/git/pull.d.ts +0 -35
  118. package/lib/api/git/pull.js +0 -69
  119. package/lib/api/git/pull.js.map +0 -7
  120. package/lib/api/git/push.d.ts +0 -52
  121. package/lib/api/git/push.js +0 -70
  122. package/lib/api/git/push.js.map +0 -7
  123. package/lib/api/git/remote.d.ts +0 -20
  124. package/lib/api/git/remote.js +0 -73
  125. package/lib/api/git/remote.js.map +0 -7
  126. package/lib/api/git/reset.d.ts +0 -12
  127. package/lib/api/git/reset.js +0 -62
  128. package/lib/api/git/reset.js.map +0 -7
  129. package/lib/api/git/statusMatrix.d.ts +0 -7
  130. package/lib/api/git/statusMatrix.js +0 -47
  131. package/lib/api/git/statusMatrix.js.map +0 -7
  132. package/lib/api/github/checkRun.d.ts +0 -44
  133. package/lib/api/github/checkRun.js +0 -81
  134. package/lib/api/github/checkRun.js.map +0 -7
  135. package/lib/api/github/environment.d.ts +0 -17
  136. package/lib/api/github/environment.js +0 -48
  137. package/lib/api/github/environment.js.map +0 -7
  138. package/lib/api/github/index.d.ts +0 -7
  139. package/lib/api/github/index.js +0 -48
  140. package/lib/api/github/index.js.map +0 -7
  141. package/lib/api/github/issueComment.d.ts +0 -61
  142. package/lib/api/github/issueComment.js +0 -99
  143. package/lib/api/github/issueComment.js.map +0 -7
  144. package/lib/api/github/octokit.d.ts +0 -6
  145. package/lib/api/github/octokit.js +0 -42
  146. package/lib/api/github/octokit.js.map +0 -7
  147. package/lib/api/github/pullRequest.d.ts +0 -21
  148. package/lib/api/github/pullRequest.js +0 -69
  149. package/lib/api/github/pullRequest.js.map +0 -7
  150. package/lib/api/github/push.d.ts +0 -85
  151. package/lib/api/github/push.js +0 -166
  152. package/lib/api/github/push.js.map +0 -7
  153. package/lib/api/net/compose.d.ts +0 -4
  154. package/lib/api/net/compose.js +0 -51
  155. package/lib/api/net/compose.js.map +0 -7
  156. package/lib/api/net/index.d.ts +0 -1
  157. package/lib/api/net/index.js.map +0 -7
  158. package/lib/api/net/socket.d.ts +0 -5
  159. package/lib/api/net/socket.js +0 -68
  160. package/lib/api/net/socket.js.map +0 -7
  161. package/lib/api/net/waitFor.d.ts +0 -22
  162. package/lib/api/net/waitFor.js +0 -40
  163. package/lib/api/net/waitFor.js.map +0 -7
  164. package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/configureTsConfigForESM.js.map +0 -7
  165. package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.d.ts +0 -6
  166. package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.js +0 -110
  167. package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.js.map +0 -7
  168. /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 12.3.0}/index.d.ts +0 -0
  169. /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/configureTsConfigForESM.d.ts +0 -0
  170. /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/index.js +0 -0
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var push_exports = {};
30
- __export(push_exports, {
31
- push: () => push
32
- });
33
- module.exports = __toCommonJS(push_exports);
34
- var import_fs_extra = __toESM(require("fs-extra"));
35
- var import_isomorphic_git = __toESM(require("isomorphic-git"));
36
- var import_node = __toESM(require("isomorphic-git/http/node"));
37
- var import_environment = require("../github/environment.js");
38
- var import_remote = require("./remote.js");
39
- const push = async ({
40
- auth,
41
- dir,
42
- ref,
43
- remote,
44
- remoteRef,
45
- force
46
- }) => {
47
- const { owner, repo } = await (0, import_remote.getOwnerAndRepo)({ dir });
48
- const url = `https://github.com/${encodeURIComponent(
49
- owner
50
- )}/${encodeURIComponent(repo)}`;
51
- return import_isomorphic_git.default.push({
52
- onAuth: () => ({
53
- username: "x-access-token",
54
- password: auth.token ?? (0, import_environment.apiTokenFromEnvironment)()
55
- }),
56
- dir,
57
- fs: import_fs_extra.default,
58
- http: import_node.default,
59
- ref,
60
- remote,
61
- remoteRef,
62
- url,
63
- force
64
- });
65
- };
66
- // Annotate the CommonJS export names for ESM import in node:
67
- 0 && (module.exports = {
68
- push
69
- });
70
- //# sourceMappingURL=push.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/git/push.ts"],
4
- "sourcesContent": ["import fs from 'fs-extra';\nimport git from 'isomorphic-git';\nimport http from 'isomorphic-git/http/node';\n\nimport { apiTokenFromEnvironment } from '../github/environment.js';\n\nimport { getOwnerAndRepo } from './remote.js';\n\n/**\n * Use a GitHub app token to auth the Git push.\n *\n * This defaults to the `GITHUB_API_TOKEN` and `GITHUB_TOKEN` environment\n * variables if `token` is not provided.\n */\ninterface GitHubAppAuth {\n type: 'gitHubApp';\n token?: string;\n}\n\ninterface PushParameters {\n /**\n * The auth mechanism for the push.\n *\n * Currently, only GitHub app tokens are supported.\n */\n auth: GitHubAppAuth;\n\n dir: string;\n\n /**\n * The reference to push to the remote.\n *\n * This may be a commit, branch or tag in the local repository.\n */\n ref: string;\n\n remote?: string;\n\n /**\n * The destination branch or tag on the remote.\n *\n * This defaults to `ref`.\n */\n remoteRef?: string;\n\n /**\n * Forcefully override any conflicts.\n *\n * This defaults to `false`.\n */\n force?: boolean;\n}\n\ninterface PushResult {\n ok: boolean;\n error: string | null;\n refs: Record<\n string,\n {\n ok: boolean;\n error: string;\n }\n >;\n headers?: Record<string, string> | undefined;\n}\n\n/**\n * Pushes the specified `ref` from the local Git repository to a remote.\n */\nexport const push = async ({\n auth,\n dir,\n ref,\n remote,\n remoteRef,\n force,\n}: PushParameters): Promise<PushResult> => {\n const { owner, repo } = await getOwnerAndRepo({ dir });\n\n const url = `https://github.com/${encodeURIComponent(\n owner,\n )}/${encodeURIComponent(repo)}`;\n\n return git.push({\n onAuth: () => ({\n username: 'x-access-token',\n password: auth.token ?? apiTokenFromEnvironment(),\n }),\n dir,\n fs,\n http,\n ref,\n remote,\n remoteRef,\n url,\n force,\n });\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AACf,4BAAgB;AAChB,kBAAiB;AAEjB,yBAAwC;AAExC,oBAAgC;AA+DzB,MAAM,OAAO,OAAO;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA2C;AACzC,QAAM,EAAE,OAAO,KAAK,IAAI,UAAM,+BAAgB,EAAE,IAAI,CAAC;AAErD,QAAM,MAAM,sBAAsB;AAAA,IAChC;AAAA,EACF,CAAC,IAAI,mBAAmB,IAAI,CAAC;AAE7B,SAAO,sBAAAA,QAAI,KAAK;AAAA,IACd,QAAQ,OAAO;AAAA,MACb,UAAU;AAAA,MACV,UAAU,KAAK,aAAS,4CAAwB;AAAA,IAClD;AAAA,IACA;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
6
- "names": ["git", "fs", "http"]
7
- }
@@ -1,20 +0,0 @@
1
- interface GetOwnerAndRepoParameters {
2
- dir: string;
3
- env?: Record<string, string | undefined>;
4
- }
5
- /**
6
- * Extracts the owner and repository names from CI environment variables,
7
- * falling back to local Git remotes.
8
- *
9
- * Currently, only GitHub repository URLs are supported:
10
- *
11
- * ```console
12
- * git@github.com:seek-oss/skuba.git
13
- * https://github.com/seek-oss/skuba.git
14
- * ```
15
- */
16
- export declare const getOwnerAndRepo: ({ dir, env, }: GetOwnerAndRepoParameters) => Promise<{
17
- owner: string;
18
- repo: string;
19
- }>;
20
- export {};
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var remote_exports = {};
30
- __export(remote_exports, {
31
- getOwnerAndRepo: () => getOwnerAndRepo
32
- });
33
- module.exports = __toCommonJS(remote_exports);
34
- var import_fs_extra = __toESM(require("fs-extra"));
35
- var import_isomorphic_git = __toESM(require("isomorphic-git"));
36
- const ownerRepoRegex = /github.com(?::|\/)(.+)\/(.+).git$/;
37
- const ownerAndRepoFromUrl = (url) => {
38
- const match = ownerRepoRegex.exec(url);
39
- const owner = match?.[1];
40
- const repo = match?.[2];
41
- return { owner, repo };
42
- };
43
- const getOwnerAndRepo = async ({
44
- dir,
45
- env = process.env
46
- }) => {
47
- if (env.GITHUB_REPOSITORY) {
48
- const [owner, repo] = env.GITHUB_REPOSITORY.split("/");
49
- if (owner && repo) {
50
- return { owner, repo };
51
- }
52
- }
53
- if (env.BUILDKITE_REPO) {
54
- const { owner, repo } = ownerAndRepoFromUrl(env.BUILDKITE_REPO);
55
- if (owner && repo) {
56
- return { owner, repo };
57
- }
58
- }
59
- const gitRoot = await import_isomorphic_git.default.findRoot({ filepath: dir, fs: import_fs_extra.default });
60
- const remotes = await import_isomorphic_git.default.listRemotes({ dir: gitRoot, fs: import_fs_extra.default });
61
- for (const { url } of remotes) {
62
- const { owner, repo } = ownerAndRepoFromUrl(url);
63
- if (owner && repo) {
64
- return { owner, repo };
65
- }
66
- }
67
- throw new Error("Could not find a GitHub remote");
68
- };
69
- // Annotate the CommonJS export names for ESM import in node:
70
- 0 && (module.exports = {
71
- getOwnerAndRepo
72
- });
73
- //# sourceMappingURL=remote.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/git/remote.ts"],
4
- "sourcesContent": ["import fs from 'fs-extra';\nimport git from 'isomorphic-git';\n\n/**\n * Matches the owner and repository names in a GitHub repository URL.\n *\n * For example, given the following input strings:\n *\n * ```console\n * git@github.com:seek-oss/skuba.git\n * https://github.com/seek-oss/skuba.git\n * ```\n *\n * This pattern will produce the following matches:\n *\n * 1. seek-oss\n * 2. skuba\n */\nconst ownerRepoRegex = /github.com(?::|\\/)(.+)\\/(.+).git$/;\n\nconst ownerAndRepoFromUrl = (url: string) => {\n const match = ownerRepoRegex.exec(url);\n\n const owner = match?.[1];\n const repo = match?.[2];\n\n return { owner, repo };\n};\n\ninterface GetOwnerAndRepoParameters {\n dir: string;\n env?: Record<string, string | undefined>;\n}\n\n/**\n * Extracts the owner and repository names from CI environment variables,\n * falling back to local Git remotes.\n *\n * Currently, only GitHub repository URLs are supported:\n *\n * ```console\n * git@github.com:seek-oss/skuba.git\n * https://github.com/seek-oss/skuba.git\n * ```\n */\nexport const getOwnerAndRepo = async ({\n dir,\n env = process.env,\n}: GetOwnerAndRepoParameters): Promise<{ owner: string; repo: string }> => {\n if (env.GITHUB_REPOSITORY) {\n const [owner, repo] = env.GITHUB_REPOSITORY.split('/');\n\n if (owner && repo) {\n return { owner, repo };\n }\n }\n\n if (env.BUILDKITE_REPO) {\n const { owner, repo } = ownerAndRepoFromUrl(env.BUILDKITE_REPO);\n\n if (owner && repo) {\n return { owner, repo };\n }\n }\n\n const gitRoot = await git.findRoot({ filepath: dir, fs });\n\n const remotes = await git.listRemotes({ dir: gitRoot, fs });\n\n for (const { url } of remotes) {\n const { owner, repo } = ownerAndRepoFromUrl(url);\n\n if (owner && repo) {\n return { owner, repo };\n }\n }\n\n throw new Error('Could not find a GitHub remote');\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AACf,4BAAgB;AAiBhB,MAAM,iBAAiB;AAEvB,MAAM,sBAAsB,CAAC,QAAgB;AAC3C,QAAM,QAAQ,eAAe,KAAK,GAAG;AAErC,QAAM,QAAQ,QAAQ,CAAC;AACvB,QAAM,OAAO,QAAQ,CAAC;AAEtB,SAAO,EAAE,OAAO,KAAK;AACvB;AAkBO,MAAM,kBAAkB,OAAO;AAAA,EACpC;AAAA,EACA,MAAM,QAAQ;AAChB,MAA2E;AACzE,MAAI,IAAI,mBAAmB;AACzB,UAAM,CAAC,OAAO,IAAI,IAAI,IAAI,kBAAkB,MAAM,GAAG;AAErD,QAAI,SAAS,MAAM;AACjB,aAAO,EAAE,OAAO,KAAK;AAAA,IACvB;AAAA,EACF;AAEA,MAAI,IAAI,gBAAgB;AACtB,UAAM,EAAE,OAAO,KAAK,IAAI,oBAAoB,IAAI,cAAc;AAE9D,QAAI,SAAS,MAAM;AACjB,aAAO,EAAE,OAAO,KAAK;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,UAAU,MAAM,sBAAAA,QAAI,SAAS,EAAE,UAAU,KAAK,oBAAAC,QAAG,CAAC;AAExD,QAAM,UAAU,MAAM,sBAAAD,QAAI,YAAY,EAAE,KAAK,SAAS,oBAAAC,QAAG,CAAC;AAE1D,aAAW,EAAE,IAAI,KAAK,SAAS;AAC7B,UAAM,EAAE,OAAO,KAAK,IAAI,oBAAoB,GAAG;AAE/C,QAAI,SAAS,MAAM;AACjB,aAAO,EAAE,OAAO,KAAK;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,IAAI,MAAM,gCAAgC;AAClD;",
6
- "names": ["git", "fs"]
7
- }
@@ -1,12 +0,0 @@
1
- interface ResetParameters {
2
- dir: string;
3
- branch: string;
4
- commitId: string;
5
- hard?: boolean;
6
- }
7
- /**
8
- * Resets the specified branch in the local Git repository to a particular
9
- * commit.
10
- */
11
- export declare const reset: ({ dir, branch, commitId, hard, }: ResetParameters) => Promise<void>;
12
- export {};
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var reset_exports = {};
30
- __export(reset_exports, {
31
- reset: () => reset
32
- });
33
- module.exports = __toCommonJS(reset_exports);
34
- var import_path = __toESM(require("path"));
35
- var import_fs_extra = __toESM(require("fs-extra"));
36
- var import_isomorphic_git = __toESM(require("isomorphic-git"));
37
- var import_statusMatrix = require("./statusMatrix.js");
38
- const reset = async ({
39
- dir,
40
- branch,
41
- commitId,
42
- hard
43
- }) => {
44
- await import_fs_extra.default.promises.writeFile(
45
- import_path.default.join(dir, ".git/refs/heads", branch),
46
- `${commitId}
47
- `
48
- );
49
- if (hard) {
50
- const allFiles = await import_isomorphic_git.default.statusMatrix({ dir, fs: import_fs_extra.default });
51
- const modifiedFiles = allFiles.filter((row) => row[import_statusMatrix.WORKDIR] > import_statusMatrix.UNMODIFIED && row[import_statusMatrix.STAGE] > import_statusMatrix.UNMODIFIED).map((row) => row[import_statusMatrix.FILEPATH]);
52
- await Promise.all(
53
- modifiedFiles.map((filePath) => import_fs_extra.default.promises.rm(filePath))
54
- );
55
- await import_isomorphic_git.default.checkout({ dir, fs: import_fs_extra.default, ref: branch, force: true });
56
- }
57
- };
58
- // Annotate the CommonJS export names for ESM import in node:
59
- 0 && (module.exports = {
60
- reset
61
- });
62
- //# sourceMappingURL=reset.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/git/reset.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport git from 'isomorphic-git';\n\nimport { FILEPATH, STAGE, UNMODIFIED, WORKDIR } from './statusMatrix.js';\n\ninterface ResetParameters {\n dir: string;\n branch: string;\n commitId: string;\n hard?: boolean;\n}\n\n/**\n * Resets the specified branch in the local Git repository to a particular\n * commit.\n */\nexport const reset = async ({\n dir,\n branch,\n commitId,\n hard,\n}: ResetParameters): Promise<void> => {\n await fs.promises.writeFile(\n path.join(dir, '.git/refs/heads', branch),\n `${commitId}\\n`,\n );\n\n if (hard) {\n const allFiles = await git.statusMatrix({ dir, fs });\n // Get all files which have been modified or staged - does not include new untracked files or deleted files\n const modifiedFiles = allFiles\n .filter((row) => row[WORKDIR] > UNMODIFIED && row[STAGE] > UNMODIFIED)\n .map((row) => row[FILEPATH]);\n\n // Delete modified/staged files\n await Promise.all(\n modifiedFiles.map((filePath) => fs.promises.rm(filePath)),\n );\n\n // This will bring in the unmodified versions of files plus any files which were deleted\n await git.checkout({ dir, fs, ref: branch, force: true });\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,4BAAgB;AAEhB,0BAAqD;AAa9C,MAAM,QAAQ,OAAO;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsC;AACpC,QAAM,gBAAAA,QAAG,SAAS;AAAA,IAChB,YAAAC,QAAK,KAAK,KAAK,mBAAmB,MAAM;AAAA,IACxC,GAAG,QAAQ;AAAA;AAAA,EACb;AAEA,MAAI,MAAM;AACR,UAAM,WAAW,MAAM,sBAAAC,QAAI,aAAa,EAAE,KAAK,oBAAAF,QAAG,CAAC;AAEnD,UAAM,gBAAgB,SACnB,OAAO,CAAC,QAAQ,IAAI,2BAAO,IAAI,kCAAc,IAAI,yBAAK,IAAI,8BAAU,EACpE,IAAI,CAAC,QAAQ,IAAI,4BAAQ,CAAC;AAG7B,UAAM,QAAQ;AAAA,MACZ,cAAc,IAAI,CAAC,aAAa,gBAAAA,QAAG,SAAS,GAAG,QAAQ,CAAC;AAAA,IAC1D;AAGA,UAAM,sBAAAE,QAAI,SAAS,EAAE,KAAK,oBAAAF,SAAI,KAAK,QAAQ,OAAO,KAAK,CAAC;AAAA,EAC1D;AACF;",
6
- "names": ["fs", "path", "git"]
7
- }
@@ -1,7 +0,0 @@
1
- export declare const FILEPATH = 0;
2
- export declare const HEAD = 1;
3
- export declare const WORKDIR = 2;
4
- export declare const STAGE = 3;
5
- export declare const ABSENT = 0;
6
- export declare const UNMODIFIED = 1;
7
- export declare const MODIFIED = 2;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var statusMatrix_exports = {};
20
- __export(statusMatrix_exports, {
21
- ABSENT: () => ABSENT,
22
- FILEPATH: () => FILEPATH,
23
- HEAD: () => HEAD,
24
- MODIFIED: () => MODIFIED,
25
- STAGE: () => STAGE,
26
- UNMODIFIED: () => UNMODIFIED,
27
- WORKDIR: () => WORKDIR
28
- });
29
- module.exports = __toCommonJS(statusMatrix_exports);
30
- const FILEPATH = 0;
31
- const HEAD = 1;
32
- const WORKDIR = 2;
33
- const STAGE = 3;
34
- const ABSENT = 0;
35
- const UNMODIFIED = 1;
36
- const MODIFIED = 2;
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- ABSENT,
40
- FILEPATH,
41
- HEAD,
42
- MODIFIED,
43
- STAGE,
44
- UNMODIFIED,
45
- WORKDIR
46
- });
47
- //# sourceMappingURL=statusMatrix.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/git/statusMatrix.ts"],
4
- "sourcesContent": ["// Based off https://isomorphic-git.org/docs/en/statusMatrix.html\n\n// Status matrix row indexes\nexport const FILEPATH = 0;\nexport const HEAD = 1;\nexport const WORKDIR = 2;\nexport const STAGE = 3;\n\n// Status matrix state\nexport const ABSENT = 0;\nexport const UNMODIFIED = 1;\nexport const MODIFIED = 2;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,WAAW;AACjB,MAAM,OAAO;AACb,MAAM,UAAU;AAChB,MAAM,QAAQ;AAGd,MAAM,SAAS;AACf,MAAM,aAAa;AACnB,MAAM,WAAW;",
6
- "names": []
7
- }
@@ -1,44 +0,0 @@
1
- import type { Endpoints } from '@octokit/types';
2
- type Output = NonNullable<Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters']['output']>;
3
- export type Annotation = NonNullable<Output['annotations']>[number];
4
- /**
5
- * {@link https://docs.github.com/en/rest/reference/checks#create-a-check-run}
6
- */
7
- interface CreateCheckRunParameters {
8
- /**
9
- * Adds information from your analysis to specific lines of code.
10
- * Annotations are visible on GitHub in the **Checks** and **Files changed**
11
- * tab of the pull request.
12
- */
13
- annotations: Annotation[];
14
- /**
15
- * The final conclusion of the check.
16
- */
17
- conclusion: 'failure' | 'success';
18
- /**
19
- * The name of the check. For example, "code-coverage".
20
- */
21
- name: string;
22
- /**
23
- * The summary of the check run. This parameter supports Markdown.
24
- */
25
- summary: string;
26
- /**
27
- * The details of the check run. This parameter supports Markdown.
28
- */
29
- text?: string;
30
- /**
31
- * The title of the check run.
32
- */
33
- title: string;
34
- }
35
- /**
36
- * Asynchronously creates a GitHub check run with annotations.
37
- *
38
- * The first 50 `annotations` are written in full to GitHub.
39
- *
40
- * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission
41
- * must be present on the environment.
42
- */
43
- export declare const createCheckRun: ({ annotations, conclusion, name, summary, text, title, }: CreateCheckRunParameters) => Promise<void>;
44
- export {};
@@ -1,81 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var checkRun_exports = {};
30
- __export(checkRun_exports, {
31
- createCheckRun: () => createCheckRun
32
- });
33
- module.exports = __toCommonJS(checkRun_exports);
34
- var import_logging = require("../../utils/logging.js");
35
- var Git = __toESM(require("../git/index.js"));
36
- var import_environment = require("./environment.js");
37
- var import_octokit = require("./octokit.js");
38
- const GITHUB_MAX_ANNOTATIONS = 50;
39
- const suffixTitle = (title, inputAnnotations) => {
40
- const addedAnnotations = inputAnnotations > GITHUB_MAX_ANNOTATIONS ? GITHUB_MAX_ANNOTATIONS : inputAnnotations;
41
- return `${title} (${(0, import_logging.pluralise)(addedAnnotations, "annotation")} added)`;
42
- };
43
- const createEnrichedSummary = (summary, inputAnnotations) => [
44
- summary,
45
- ...inputAnnotations > GITHUB_MAX_ANNOTATIONS ? [
46
- `${inputAnnotations} annotations were provided, but only the first ${GITHUB_MAX_ANNOTATIONS} are visible in GitHub.`
47
- ] : []
48
- ].join("\n\n");
49
- const createCheckRun = async ({
50
- annotations,
51
- conclusion,
52
- name,
53
- summary,
54
- text,
55
- title
56
- }) => {
57
- const dir = process.cwd();
58
- const [commitId, { owner, repo }] = await Promise.all([
59
- Git.getHeadCommitId({ dir }),
60
- Git.getOwnerAndRepo({ dir })
61
- ]);
62
- const client = await (0, import_octokit.createRestClient)({ auth: (0, import_environment.apiTokenFromEnvironment)() });
63
- await client.checks.create({
64
- conclusion,
65
- head_sha: commitId,
66
- name,
67
- output: {
68
- annotations: annotations.slice(0, GITHUB_MAX_ANNOTATIONS),
69
- summary: createEnrichedSummary(summary, annotations.length),
70
- text,
71
- title: suffixTitle(title, annotations.length)
72
- },
73
- owner,
74
- repo
75
- });
76
- };
77
- // Annotate the CommonJS export names for ESM import in node:
78
- 0 && (module.exports = {
79
- createCheckRun
80
- });
81
- //# sourceMappingURL=checkRun.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/github/checkRun.ts"],
4
- "sourcesContent": ["import type { Endpoints } from '@octokit/types';\n\nimport { pluralise } from '../../utils/logging.js';\nimport * as Git from '../git/index.js';\n\nimport { apiTokenFromEnvironment } from './environment.js';\nimport { createRestClient } from './octokit.js';\n\ntype Output = NonNullable<\n Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters']['output']\n>;\n\nexport type Annotation = NonNullable<Output['annotations']>[number];\n\nconst GITHUB_MAX_ANNOTATIONS = 50;\n\n/**\n * Suffixes the title with the number of annotations added, e.g.\n *\n * ```text\n * Build #12 failed (24 annotations added)\n * ```\n */\nconst suffixTitle = (title: string, inputAnnotations: number): string => {\n const addedAnnotations =\n inputAnnotations > GITHUB_MAX_ANNOTATIONS\n ? GITHUB_MAX_ANNOTATIONS\n : inputAnnotations;\n\n return `${title} (${pluralise(addedAnnotations, 'annotation')} added)`;\n};\n\n/**\n * Enriches the summary with more context about the check run.\n */\nconst createEnrichedSummary = (\n summary: string,\n inputAnnotations: number,\n): string =>\n [\n summary,\n ...(inputAnnotations > GITHUB_MAX_ANNOTATIONS\n ? [\n `${inputAnnotations} annotations were provided, but only the first ${GITHUB_MAX_ANNOTATIONS} are visible in GitHub.`,\n ]\n : []),\n ].join('\\n\\n');\n\n/**\n * {@link https://docs.github.com/en/rest/reference/checks#create-a-check-run}\n */\ninterface CreateCheckRunParameters {\n /**\n * Adds information from your analysis to specific lines of code.\n * Annotations are visible on GitHub in the **Checks** and **Files changed**\n * tab of the pull request.\n */\n annotations: Annotation[];\n\n /**\n * The final conclusion of the check.\n */\n conclusion: 'failure' | 'success';\n\n /**\n * The name of the check. For example, \"code-coverage\".\n */\n name: string;\n\n /**\n * The summary of the check run. This parameter supports Markdown.\n */\n summary: string;\n\n /**\n * The details of the check run. This parameter supports Markdown.\n */\n text?: string;\n\n /**\n * The title of the check run.\n */\n title: string;\n}\n\n/**\n * Asynchronously creates a GitHub check run with annotations.\n *\n * The first 50 `annotations` are written in full to GitHub.\n *\n * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission\n * must be present on the environment.\n */\nexport const createCheckRun = async ({\n annotations,\n conclusion,\n name,\n summary,\n text,\n title,\n}: CreateCheckRunParameters): Promise<void> => {\n const dir = process.cwd();\n\n const [commitId, { owner, repo }] = await Promise.all([\n Git.getHeadCommitId({ dir }),\n Git.getOwnerAndRepo({ dir }),\n ]);\n\n const client = await createRestClient({ auth: apiTokenFromEnvironment() });\n\n await client.checks.create({\n conclusion,\n head_sha: commitId,\n name,\n output: {\n annotations: annotations.slice(0, GITHUB_MAX_ANNOTATIONS),\n summary: createEnrichedSummary(summary, annotations.length),\n text,\n title: suffixTitle(title, annotations.length),\n },\n owner,\n repo,\n });\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAA0B;AAC1B,UAAqB;AAErB,yBAAwC;AACxC,qBAAiC;AAQjC,MAAM,yBAAyB;AAS/B,MAAM,cAAc,CAAC,OAAe,qBAAqC;AACvE,QAAM,mBACJ,mBAAmB,yBACf,yBACA;AAEN,SAAO,GAAG,KAAK,SAAK,0BAAU,kBAAkB,YAAY,CAAC;AAC/D;AAKA,MAAM,wBAAwB,CAC5B,SACA,qBAEA;AAAA,EACE;AAAA,EACA,GAAI,mBAAmB,yBACnB;AAAA,IACE,GAAG,gBAAgB,kDAAkD,sBAAsB;AAAA,EAC7F,IACA,CAAC;AACP,EAAE,KAAK,MAAM;AA+CR,MAAM,iBAAiB,OAAO;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA+C;AAC7C,QAAM,MAAM,QAAQ,IAAI;AAExB,QAAM,CAAC,UAAU,EAAE,OAAO,KAAK,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,IACpD,IAAI,gBAAgB,EAAE,IAAI,CAAC;AAAA,IAC3B,IAAI,gBAAgB,EAAE,IAAI,CAAC;AAAA,EAC7B,CAAC;AAED,QAAM,SAAS,UAAM,iCAAiB,EAAE,UAAM,4CAAwB,EAAE,CAAC;AAEzE,QAAM,OAAO,OAAO,OAAO;AAAA,IACzB;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACN,aAAa,YAAY,MAAM,GAAG,sBAAsB;AAAA,MACxD,SAAS,sBAAsB,SAAS,YAAY,MAAM;AAAA,MAC1D;AAAA,MACA,OAAO,YAAY,OAAO,YAAY,MAAM;AAAA,IAC9C;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
6
- "names": []
7
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Returns the name of the build as seen in GitHub status checks.
3
- *
4
- * This is driven off of environment variables and falls back to `Build`.
5
- */
6
- export declare const buildNameFromEnvironment: (env?: NodeJS.ProcessEnv) => string;
7
- /**
8
- * Whether GitHub API interactions should be enabled.
9
- *
10
- * This checks environment variables to see if the code is executing in a CI
11
- * environment and has access to a GitHub API token.
12
- */
13
- export declare const enabledFromEnvironment: (env?: NodeJS.ProcessEnv) => boolean;
14
- /**
15
- * Tries to return a GitHub API token from the environment.
16
- */
17
- export declare const apiTokenFromEnvironment: (env?: NodeJS.ProcessEnv) => string | undefined;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var environment_exports = {};
20
- __export(environment_exports, {
21
- apiTokenFromEnvironment: () => apiTokenFromEnvironment,
22
- buildNameFromEnvironment: () => buildNameFromEnvironment,
23
- enabledFromEnvironment: () => enabledFromEnvironment
24
- });
25
- module.exports = __toCommonJS(environment_exports);
26
- var import_env = require("../../utils/env.js");
27
- const buildNameFromEnvironment = (env = process.env) => {
28
- if (env.BUILDKITE_BUILD_NUMBER) {
29
- return `Build #${env.BUILDKITE_BUILD_NUMBER}`;
30
- }
31
- if (env.GITHUB_RUN_NUMBER) {
32
- return `${env.GITHUB_WORKFLOW ?? "Build"} #${env.GITHUB_RUN_NUMBER}`;
33
- }
34
- return "Build";
35
- };
36
- const enabledFromEnvironment = (env = process.env) => (
37
- // Running in a CI environment.
38
- (0, import_env.isCiEnv)(env) && // Has an API token at the ready.
39
- Boolean(apiTokenFromEnvironment(env))
40
- );
41
- const apiTokenFromEnvironment = (env = process.env) => env.GITHUB_API_TOKEN ?? env.GITHUB_TOKEN;
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- apiTokenFromEnvironment,
45
- buildNameFromEnvironment,
46
- enabledFromEnvironment
47
- });
48
- //# sourceMappingURL=environment.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/github/environment.ts"],
4
- "sourcesContent": ["import { isCiEnv } from '../../utils/env.js';\n\n/**\n * Returns the name of the build as seen in GitHub status checks.\n *\n * This is driven off of environment variables and falls back to `Build`.\n */\nexport const buildNameFromEnvironment = (env = process.env): string => {\n if (env.BUILDKITE_BUILD_NUMBER) {\n return `Build #${env.BUILDKITE_BUILD_NUMBER}`;\n }\n\n if (env.GITHUB_RUN_NUMBER) {\n return `${env.GITHUB_WORKFLOW ?? 'Build'} #${env.GITHUB_RUN_NUMBER}`;\n }\n\n return 'Build';\n};\n\n/**\n * Whether GitHub API interactions should be enabled.\n *\n * This checks environment variables to see if the code is executing in a CI\n * environment and has access to a GitHub API token.\n */\nexport const enabledFromEnvironment = (env = process.env): boolean =>\n // Running in a CI environment.\n isCiEnv(env) &&\n // Has an API token at the ready.\n Boolean(apiTokenFromEnvironment(env));\n\n/**\n * Tries to return a GitHub API token from the environment.\n */\nexport const apiTokenFromEnvironment = (\n env = process.env,\n): string | undefined => env.GITHUB_API_TOKEN ?? env.GITHUB_TOKEN;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAwB;AAOjB,MAAM,2BAA2B,CAAC,MAAM,QAAQ,QAAgB;AACrE,MAAI,IAAI,wBAAwB;AAC9B,WAAO,UAAU,IAAI,sBAAsB;AAAA,EAC7C;AAEA,MAAI,IAAI,mBAAmB;AACzB,WAAO,GAAG,IAAI,mBAAmB,OAAO,KAAK,IAAI,iBAAiB;AAAA,EACpE;AAEA,SAAO;AACT;AAQO,MAAM,yBAAyB,CAAC,MAAM,QAAQ;AAAA;AAAA,MAEnD,oBAAQ,GAAG;AAAA,EAEX,QAAQ,wBAAwB,GAAG,CAAC;AAAA;AAK/B,MAAM,0BAA0B,CACrC,MAAM,QAAQ,QACS,IAAI,oBAAoB,IAAI;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- export type { Annotation } from './checkRun.js';
2
- export { buildNameFromEnvironment } from './environment.js';
3
- export { createCheckRun } from './checkRun.js';
4
- export { enabledFromEnvironment } from './environment.js';
5
- export { getPullRequestNumber } from './pullRequest.js';
6
- export { putIssueComment } from './issueComment.js';
7
- export { readFileChanges, uploadAllFileChanges, uploadFileChanges, } from './push.js';
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var github_exports = {};
20
- __export(github_exports, {
21
- buildNameFromEnvironment: () => import_environment.buildNameFromEnvironment,
22
- createCheckRun: () => import_checkRun.createCheckRun,
23
- enabledFromEnvironment: () => import_environment2.enabledFromEnvironment,
24
- getPullRequestNumber: () => import_pullRequest.getPullRequestNumber,
25
- putIssueComment: () => import_issueComment.putIssueComment,
26
- readFileChanges: () => import_push.readFileChanges,
27
- uploadAllFileChanges: () => import_push.uploadAllFileChanges,
28
- uploadFileChanges: () => import_push.uploadFileChanges
29
- });
30
- module.exports = __toCommonJS(github_exports);
31
- var import_environment = require("./environment.js");
32
- var import_checkRun = require("./checkRun.js");
33
- var import_environment2 = require("./environment.js");
34
- var import_pullRequest = require("./pullRequest.js");
35
- var import_issueComment = require("./issueComment.js");
36
- var import_push = require("./push.js");
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- buildNameFromEnvironment,
40
- createCheckRun,
41
- enabledFromEnvironment,
42
- getPullRequestNumber,
43
- putIssueComment,
44
- readFileChanges,
45
- uploadAllFileChanges,
46
- uploadFileChanges
47
- });
48
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/github/index.ts"],
4
- "sourcesContent": ["export type { Annotation } from './checkRun.js';\nexport { buildNameFromEnvironment } from './environment.js';\nexport { createCheckRun } from './checkRun.js';\nexport { enabledFromEnvironment } from './environment.js';\nexport { getPullRequestNumber } from './pullRequest.js';\nexport { putIssueComment } from './issueComment.js';\nexport {\n readFileChanges,\n uploadAllFileChanges,\n uploadFileChanges,\n} from './push.js';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAAyC;AACzC,sBAA+B;AAC/B,IAAAA,sBAAuC;AACvC,yBAAqC;AACrC,0BAAgC;AAChC,kBAIO;",
6
- "names": ["import_environment"]
7
- }