skuba 13.0.0-custom-conditions-exports-20250923055337 → 13.0.0-custom-conditions-exports-20251003064544
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.
- package/lib/cli/build/assets.js +3 -7
- package/lib/cli/build/assets.js.map +2 -2
- package/lib/cli/build/esbuild.d.ts +2 -1
- package/lib/cli/build/esbuild.js +4 -3
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +8 -4
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/init/git.js +1 -1
- package/lib/cli/init/git.js.map +2 -2
- package/lib/cli/init/index.js +4 -4
- package/lib/cli/init/index.js.map +3 -3
- package/lib/cli/lint/annotate/buildkite/eslint.js +1 -1
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/index.js +1 -1
- package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/internal.js +1 -1
- package/lib/cli/lint/annotate/buildkite/internal.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/prettier.js +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/tsc.js +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/github/eslint.d.ts +1 -1
- package/lib/cli/lint/annotate/github/eslint.js.map +2 -2
- package/lib/cli/lint/annotate/github/index.js +3 -4
- package/lib/cli/lint/annotate/github/index.js.map +2 -2
- package/lib/cli/lint/annotate/github/internal.d.ts +1 -1
- package/lib/cli/lint/annotate/github/internal.js.map +2 -2
- package/lib/cli/lint/annotate/github/prettier.d.ts +1 -1
- package/lib/cli/lint/annotate/github/prettier.js.map +2 -2
- package/lib/cli/lint/annotate/github/tsc.d.ts +1 -1
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/autofix.d.ts +1 -1
- package/lib/cli/lint/autofix.js +3 -3
- package/lib/cli/lint/autofix.js.map +2 -2
- package/lib/cli/lint/internalLints/patchRenovateConfig.js +1 -1
- package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
- package/lib/{api/buildkite → cli/lint/internalLints/upgrade/patches/12.3.0}/index.js +17 -9
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +3 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +100 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +3 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +99 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +2 -0
- package/lib/{api/net → cli/lint/internalLints/upgrade/patches/12.4.0}/index.js +12 -6
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +3 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +101 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/configureTsConfigForESM.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/index.d.ts +2 -0
- package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.d.ts +13 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.js +225 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.js.map +7 -0
- package/lib/cli/test/reporters/github/annotations.d.ts +1 -1
- package/lib/cli/test/reporters/github/annotations.js.map +1 -1
- package/lib/cli/test/reporters/github/index.js +3 -4
- package/lib/cli/test/reporters/github/index.js.map +2 -2
- package/lib/index.d.ts +4 -4
- package/lib/index.js +4 -4
- package/lib/index.js.map +2 -2
- package/lib/utils/dir.js +2 -2
- package/lib/utils/dir.js.map +3 -3
- package/lib/utils/manifest.d.ts +5 -1
- package/lib/utils/manifest.js +16 -7
- package/lib/utils/manifest.js.map +2 -2
- package/package.json +4 -3
- package/template/base/_pnpm-workspace.yaml +1 -0
- package/template/express-rest-api/Dockerfile +1 -1
- package/template/express-rest-api/Dockerfile.dev-deps +0 -2
- package/template/express-rest-api/package.json +1 -1
- package/template/greeter/Dockerfile +0 -2
- package/template/greeter/package.json +2 -2
- package/template/koa-rest-api/Dockerfile +1 -1
- package/template/koa-rest-api/Dockerfile.dev-deps +0 -2
- package/template/koa-rest-api/package.json +1 -1
- package/template/lambda-sqs-worker-cdk/Dockerfile +0 -2
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
- package/template/lambda-sqs-worker-cdk/package.json +2 -2
- package/template/oss-npm-package/.github/workflows/release.yml +1 -1
- package/template/oss-npm-package/README.md +1 -1
- package/lib/api/buildkite/annotate.d.ts +0 -28
- package/lib/api/buildkite/annotate.js +0 -62
- package/lib/api/buildkite/annotate.js.map +0 -7
- package/lib/api/buildkite/index.d.ts +0 -3
- package/lib/api/buildkite/index.js.map +0 -7
- package/lib/api/buildkite/md.d.ts +0 -6
- package/lib/api/buildkite/md.js +0 -33
- package/lib/api/buildkite/md.js.map +0 -7
- package/lib/api/git/commit.d.ts +0 -15
- package/lib/api/git/commit.js +0 -52
- package/lib/api/git/commit.js.map +0 -7
- package/lib/api/git/commitAllChanges.d.ts +0 -19
- package/lib/api/git/commitAllChanges.js +0 -83
- package/lib/api/git/commitAllChanges.js.map +0 -7
- package/lib/api/git/currentBranch.d.ts +0 -10
- package/lib/api/git/currentBranch.js +0 -59
- package/lib/api/git/currentBranch.js.map +0 -7
- package/lib/api/git/findRoot.d.ts +0 -9
- package/lib/api/git/findRoot.js +0 -52
- package/lib/api/git/findRoot.js.map +0 -7
- package/lib/api/git/getChangedFiles.d.ts +0 -20
- package/lib/api/git/getChangedFiles.js +0 -81
- package/lib/api/git/getChangedFiles.js.map +0 -7
- package/lib/api/git/index.d.ts +0 -12
- package/lib/api/git/index.js +0 -61
- package/lib/api/git/index.js.map +0 -7
- package/lib/api/git/isFileGitIgnored.d.ts +0 -4
- package/lib/api/git/isFileGitIgnored.js +0 -49
- package/lib/api/git/isFileGitIgnored.js.map +0 -7
- package/lib/api/git/log.d.ts +0 -19
- package/lib/api/git/log.js +0 -71
- package/lib/api/git/log.js.map +0 -7
- package/lib/api/git/pull.d.ts +0 -35
- package/lib/api/git/pull.js +0 -69
- package/lib/api/git/pull.js.map +0 -7
- package/lib/api/git/push.d.ts +0 -52
- package/lib/api/git/push.js +0 -70
- package/lib/api/git/push.js.map +0 -7
- package/lib/api/git/remote.d.ts +0 -20
- package/lib/api/git/remote.js +0 -73
- package/lib/api/git/remote.js.map +0 -7
- package/lib/api/git/reset.d.ts +0 -12
- package/lib/api/git/reset.js +0 -62
- package/lib/api/git/reset.js.map +0 -7
- package/lib/api/git/statusMatrix.d.ts +0 -7
- package/lib/api/git/statusMatrix.js +0 -47
- package/lib/api/git/statusMatrix.js.map +0 -7
- package/lib/api/github/checkRun.d.ts +0 -44
- package/lib/api/github/checkRun.js +0 -81
- package/lib/api/github/checkRun.js.map +0 -7
- package/lib/api/github/environment.d.ts +0 -17
- package/lib/api/github/environment.js +0 -48
- package/lib/api/github/environment.js.map +0 -7
- package/lib/api/github/index.d.ts +0 -7
- package/lib/api/github/index.js +0 -48
- package/lib/api/github/index.js.map +0 -7
- package/lib/api/github/issueComment.d.ts +0 -61
- package/lib/api/github/issueComment.js +0 -99
- package/lib/api/github/issueComment.js.map +0 -7
- package/lib/api/github/octokit.d.ts +0 -6
- package/lib/api/github/octokit.js +0 -42
- package/lib/api/github/octokit.js.map +0 -7
- package/lib/api/github/pullRequest.d.ts +0 -21
- package/lib/api/github/pullRequest.js +0 -69
- package/lib/api/github/pullRequest.js.map +0 -7
- package/lib/api/github/push.d.ts +0 -85
- package/lib/api/github/push.js +0 -166
- package/lib/api/github/push.js.map +0 -7
- package/lib/api/net/compose.d.ts +0 -4
- package/lib/api/net/compose.js +0 -51
- package/lib/api/net/compose.js.map +0 -7
- package/lib/api/net/index.d.ts +0 -1
- package/lib/api/net/index.js.map +0 -7
- package/lib/api/net/socket.d.ts +0 -5
- package/lib/api/net/socket.js +0 -68
- package/lib/api/net/socket.js.map +0 -7
- package/lib/api/net/waitFor.d.ts +0 -22
- package/lib/api/net/waitFor.js +0 -40
- package/lib/api/net/waitFor.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.d.ts +0 -6
- package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.js +0 -110
- package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.js.map +0 -7
- /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 12.3.0}/index.d.ts +0 -0
- /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/configureTsConfigForESM.d.ts +0 -0
- /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/configureTsConfigForESM.js +0 -0
- /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/index.js +0 -0
package/lib/api/git/remote.js
DELETED
|
@@ -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
|
-
}
|
package/lib/api/git/reset.d.ts
DELETED
|
@@ -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 {};
|
package/lib/api/git/reset.js
DELETED
|
@@ -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
|
package/lib/api/git/reset.js.map
DELETED
|
@@ -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,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';
|
package/lib/api/github/index.js
DELETED
|
@@ -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
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://docs.github.com/en/rest/reference/issues#create-an-issue-comment
|
|
3
|
-
*/
|
|
4
|
-
interface PutIssueCommentParameters {
|
|
5
|
-
/**
|
|
6
|
-
* The body of the issue comment.
|
|
7
|
-
*
|
|
8
|
-
* An explicit `null` value will remove the comment, if `internalId` is provided.
|
|
9
|
-
*/
|
|
10
|
-
body: string | null;
|
|
11
|
-
/**
|
|
12
|
-
* An internal identifier for the issue comment.
|
|
13
|
-
*
|
|
14
|
-
* This can be used to scope a given `put` to a particular comment, preventing
|
|
15
|
-
* it from clobbering other comments from the same bot or user.
|
|
16
|
-
*
|
|
17
|
-
* The identifier is embedded as hidden content in the comment body.
|
|
18
|
-
*/
|
|
19
|
-
internalId?: string;
|
|
20
|
-
env?: Record<string, string | undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* The number that identifies the GitHub issue.
|
|
23
|
-
*
|
|
24
|
-
* If this is not provided, the number will be inferred from the GitHub Repos
|
|
25
|
-
* API by finding the latest pull request associated with the head commit.
|
|
26
|
-
*
|
|
27
|
-
* https://docs.github.com/en/rest/reference/repos#list-pull-requests-associated-with-a-commit
|
|
28
|
-
*/
|
|
29
|
-
issueNumber?: number;
|
|
30
|
-
/**
|
|
31
|
-
* The ID of authenticated bot or user that is putting the issue comment.
|
|
32
|
-
*
|
|
33
|
-
* This drives our `put` behaviour, which tries to locate and edit an existing
|
|
34
|
-
* comment before creating a new one. If this is not provided, the ID will be
|
|
35
|
-
* inferred from the GitHub Users API.
|
|
36
|
-
*
|
|
37
|
-
* https://docs.github.com/en/rest/reference/users#get-the-authenticated-user
|
|
38
|
-
*
|
|
39
|
-
* If you're at SEEK and using BuildAgency's GitHub API integration, you may
|
|
40
|
-
* use `'seek-build-agency'` as an optimisation to skip the user lookup.
|
|
41
|
-
*
|
|
42
|
-
* https://api.github.com/users/buildagencygitapitoken[bot]
|
|
43
|
-
*/
|
|
44
|
-
userId?: number | 'seek-build-agency';
|
|
45
|
-
}
|
|
46
|
-
interface IssueComment {
|
|
47
|
-
id: number;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Asynchronously creates or updates a GitHub issue comment.
|
|
51
|
-
*
|
|
52
|
-
* This emulates `put` behaviour by overwriting the first existing comment by
|
|
53
|
-
* the same author on the issue, enabling use cases like a persistent bot
|
|
54
|
-
* comment at the top of the pull request that reflects the current status of a
|
|
55
|
-
* CI check.
|
|
56
|
-
*
|
|
57
|
-
* A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be present
|
|
58
|
-
* on the environment.
|
|
59
|
-
*/
|
|
60
|
-
export declare const putIssueComment: (params: PutIssueCommentParameters) => Promise<IssueComment | null>;
|
|
61
|
-
export {};
|