skuba 13.0.0-subpath-imports-20250722044721 → 13.0.0-subpath-imports-20251003044159
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/README.md +1 -2
- package/config/tsconfig.json +2 -1
- package/jest/moduleNameMapper.js +3 -11
- package/lib/cli/build/assets.js +4 -8
- package/lib/cli/build/assets.js.map +2 -2
- package/lib/cli/build/esbuild.d.ts +2 -1
- package/lib/cli/build/esbuild.js +5 -4
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +9 -5
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/build/tsc.d.ts +9 -2
- package/lib/cli/build/tsc.js +76 -40
- package/lib/cli/build/tsc.js.map +3 -3
- package/lib/cli/configure/analyseDependencies.d.ts +2 -2
- package/lib/cli/configure/analyseDependencies.js.map +1 -1
- package/lib/cli/configure/analysis/package.d.ts +1 -1
- package/lib/cli/configure/analysis/package.js +1 -1
- package/lib/cli/configure/analysis/package.js.map +2 -2
- package/lib/cli/configure/ensureTemplateCompletion.d.ts +2 -2
- package/lib/cli/configure/ensureTemplateCompletion.js.map +1 -1
- package/lib/cli/configure/getEntryPoint.d.ts +2 -2
- package/lib/cli/configure/getEntryPoint.js.map +1 -1
- package/lib/cli/configure/getProjectType.d.ts +2 -2
- package/lib/cli/configure/getProjectType.js.map +1 -1
- package/lib/cli/configure/processing/configFile.d.ts +1 -1
- package/lib/cli/configure/processing/configFile.js +48 -6
- package/lib/cli/configure/processing/configFile.js.map +2 -2
- package/lib/cli/configure/processing/package.js +8 -2
- package/lib/cli/configure/processing/package.js.map +2 -2
- package/lib/cli/init/getConfig.js +1 -1
- package/lib/cli/init/getConfig.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/internal.js +1 -1
- package/lib/cli/lint/internal.js.map +2 -2
- package/lib/cli/lint/internalLints/patchRenovateConfig.js +3 -3
- package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +5 -3
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.d.ts +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.js.map +1 -1
- package/lib/{api/buildkite/md.js → cli/lint/internalLints/upgrade/patches/12.0.2/index.js} +13 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.d.ts +4 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +162 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.d.ts +2 -0
- package/lib/{api/net → cli/lint/internalLints/upgrade/patches/12.1.1}/index.js +12 -6
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.d.ts +3 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +105 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.d.ts +2 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +40 -0
- 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/buildkite → cli/lint/internalLints/upgrade/patches/12.4.0}/index.js +12 -9
- 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/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 +221 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +2 -2
- package/lib/cli/node/index.js +8 -2
- package/lib/cli/node/index.js.map +2 -2
- package/lib/cli/start/index.js +8 -2
- package/lib/cli/start/index.js.map +2 -2
- package/lib/cli/test/index.d.ts +1 -1
- package/lib/cli/test/index.js +18 -4
- package/lib/cli/test/index.js.map +2 -2
- 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/args.d.ts +2 -0
- package/lib/utils/args.js +5 -0
- package/lib/utils/args.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 +6 -2
- package/lib/utils/manifest.js +17 -8
- package/lib/utils/manifest.js.map +2 -2
- package/lib/utils/template.d.ts +1 -1
- package/package.json +21 -24
- package/template/base/_.prettierrc.js +1 -1
- package/template/base/_eslint.config.js +1 -1
- package/template/base/_pnpm-workspace.yaml +14 -3
- package/template/base/jest.config.ts +7 -12
- package/template/base/jest.setup.ts +1 -1
- package/template/express-rest-api/.buildkite/pipeline.yml +6 -0
- package/template/express-rest-api/.env +1 -1
- package/template/express-rest-api/.gantry/dev.yml +5 -1
- package/template/express-rest-api/.gantry/prod.yml +5 -1
- package/template/express-rest-api/Dockerfile +2 -2
- package/template/express-rest-api/Dockerfile.dev-deps +0 -2
- package/template/express-rest-api/README.md +5 -5
- package/template/express-rest-api/gantry.apply.yml +17 -1
- package/template/express-rest-api/package.json +11 -5
- package/template/express-rest-api/src/api/healthCheck.ts +2 -2
- package/template/express-rest-api/src/config.ts +7 -7
- package/template/express-rest-api/src/framework/logging.ts +11 -7
- package/template/express-rest-api/src/framework/metrics.ts +1 -1
- package/template/express-rest-api/src/listen.ts +6 -0
- package/template/express-rest-api/src/tracing.ts +56 -0
- package/template/greeter/Dockerfile +0 -2
- package/template/greeter/README.md +2 -2
- package/template/greeter/package.json +2 -2
- package/template/koa-rest-api/.buildkite/pipeline.yml +6 -0
- package/template/koa-rest-api/.env +1 -1
- package/template/koa-rest-api/.gantry/dev.yml +3 -3
- package/template/koa-rest-api/.gantry/prod.yml +3 -3
- package/template/koa-rest-api/Dockerfile +1 -1
- package/template/koa-rest-api/Dockerfile.dev-deps +0 -2
- package/template/koa-rest-api/README.md +6 -6
- package/template/koa-rest-api/gantry.apply.yml +15 -3
- package/template/koa-rest-api/package.json +13 -14
- package/template/koa-rest-api/src/api/healthCheck.ts +2 -2
- package/template/koa-rest-api/src/config.ts +7 -7
- package/template/koa-rest-api/src/framework/logging.ts +12 -8
- package/template/koa-rest-api/src/framework/metrics.ts +1 -1
- package/template/koa-rest-api/src/framework/server.test.ts +7 -8
- package/template/koa-rest-api/src/framework/server.ts +1 -4
- package/template/koa-rest-api/src/listen.ts +6 -0
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +6 -2
- package/template/lambda-sqs-worker-cdk/.env +1 -1
- package/template/lambda-sqs-worker-cdk/Dockerfile +0 -2
- package/template/lambda-sqs-worker-cdk/README.md +8 -8
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +54 -26
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +5 -22
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +16 -9
- package/template/lambda-sqs-worker-cdk/infra/config.ts +34 -20
- package/template/lambda-sqs-worker-cdk/infra/index.ts +1 -1
- package/template/lambda-sqs-worker-cdk/package.json +7 -9
- package/template/lambda-sqs-worker-cdk/src/app.test.ts +91 -51
- package/template/lambda-sqs-worker-cdk/src/app.ts +10 -9
- package/template/lambda-sqs-worker-cdk/src/config.ts +11 -16
- package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +10 -5
- package/template/lambda-sqs-worker-cdk/src/framework/handler.ts +48 -24
- package/template/lambda-sqs-worker-cdk/src/framework/logging.ts +23 -11
- package/template/lambda-sqs-worker-cdk/src/framework/metrics.ts +1 -4
- package/template/lambda-sqs-worker-cdk/src/testing/handler.ts +4 -1
- package/template/oss-npm-package/.github/workflows/release.yml +7 -8
- package/template/oss-npm-package/.github/workflows/validate.yml +6 -6
- package/template/oss-npm-package/README.md +1 -1
- package/template/oss-npm-package/_package.json +0 -3
- package/template/oss-npm-package/skuba.template.js +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.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 -104
- 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.0.2}/index.d.ts +0 -0
- /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/index.js +0 -0
|
@@ -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 {};
|
|
@@ -1,99 +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 issueComment_exports = {};
|
|
30
|
-
__export(issueComment_exports, {
|
|
31
|
-
putIssueComment: () => putIssueComment
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(issueComment_exports);
|
|
34
|
-
var Git = __toESM(require("../git/index.js"));
|
|
35
|
-
var import_environment = require("./environment.js");
|
|
36
|
-
var import_octokit = require("./octokit.js");
|
|
37
|
-
var import_pullRequest = require("./pullRequest.js");
|
|
38
|
-
const getUserId = async (client) => {
|
|
39
|
-
const { data } = await client.users.getAuthenticated();
|
|
40
|
-
return data.id;
|
|
41
|
-
};
|
|
42
|
-
const putIssueComment = async (params) => {
|
|
43
|
-
if (params.body === null && !params.internalId) {
|
|
44
|
-
throw new Error("Cannot remove comment without an internalId");
|
|
45
|
-
}
|
|
46
|
-
const env = params.env ?? process.env;
|
|
47
|
-
const dir = process.cwd();
|
|
48
|
-
const { owner, repo } = await Git.getOwnerAndRepo({ dir });
|
|
49
|
-
const client = await (0, import_octokit.createRestClient)({ auth: (0, import_environment.apiTokenFromEnvironment)() });
|
|
50
|
-
const issueNumber = params.issueNumber ?? await (0, import_pullRequest.getPullRequestNumber)({ client, env });
|
|
51
|
-
if (!issueNumber) {
|
|
52
|
-
throw new Error("Failed to infer an issue number");
|
|
53
|
-
}
|
|
54
|
-
const comments = await client.issues.listComments({
|
|
55
|
-
issue_number: issueNumber,
|
|
56
|
-
owner,
|
|
57
|
-
repo
|
|
58
|
-
});
|
|
59
|
-
const userId = params.userId === "seek-build-agency" ? (
|
|
60
|
-
// https://api.github.com/users/buildagencygitapitoken[bot]
|
|
61
|
-
87109344
|
|
62
|
-
) : params.userId ?? await getUserId(client);
|
|
63
|
-
const commentId = comments.data.find(
|
|
64
|
-
(comment) => comment.user?.id === userId && (params.internalId ? comment.body?.endsWith(`
|
|
65
|
-
|
|
66
|
-
<!-- ${params.internalId} -->`) : true)
|
|
67
|
-
)?.id;
|
|
68
|
-
if (params.body === null) {
|
|
69
|
-
if (commentId) {
|
|
70
|
-
await client.issues.deleteComment({
|
|
71
|
-
comment_id: commentId,
|
|
72
|
-
owner,
|
|
73
|
-
repo
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
const body = params.internalId ? [params.body.trim(), `<!-- ${params.internalId} -->`].join("\n\n") : params.body.trim();
|
|
79
|
-
const response = await (commentId ? client.issues.updateComment({
|
|
80
|
-
body,
|
|
81
|
-
comment_id: commentId,
|
|
82
|
-
issue_number: issueNumber,
|
|
83
|
-
owner,
|
|
84
|
-
repo
|
|
85
|
-
}) : client.issues.createComment({
|
|
86
|
-
body,
|
|
87
|
-
issue_number: issueNumber,
|
|
88
|
-
owner,
|
|
89
|
-
repo
|
|
90
|
-
}));
|
|
91
|
-
return {
|
|
92
|
-
id: response.data.id
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
-
0 && (module.exports = {
|
|
97
|
-
putIssueComment
|
|
98
|
-
});
|
|
99
|
-
//# sourceMappingURL=issueComment.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/api/github/issueComment.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Octokit } from '@octokit/rest';\n\nimport * as Git from '../git/index.js';\n\nimport { apiTokenFromEnvironment } from './environment.js';\nimport { createRestClient } from './octokit.js';\nimport { getPullRequestNumber } from './pullRequest.js';\n\nconst getUserId = async (client: Octokit): Promise<number> => {\n const { data } = await client.users.getAuthenticated();\n\n return data.id;\n};\n\n/**\n * https://docs.github.com/en/rest/reference/issues#create-an-issue-comment\n */\ninterface PutIssueCommentParameters {\n /**\n * The body of the issue comment.\n *\n * An explicit `null` value will remove the comment, if `internalId` is provided.\n */\n body: string | null;\n\n /**\n * An internal identifier for the issue comment.\n *\n * This can be used to scope a given `put` to a particular comment, preventing\n * it from clobbering other comments from the same bot or user.\n *\n * The identifier is embedded as hidden content in the comment body.\n */\n internalId?: string;\n\n env?: Record<string, string | undefined>;\n\n /**\n * The number that identifies the GitHub issue.\n *\n * If this is not provided, the number will be inferred from the GitHub Repos\n * API by finding the latest pull request associated with the head commit.\n *\n * https://docs.github.com/en/rest/reference/repos#list-pull-requests-associated-with-a-commit\n */\n issueNumber?: number;\n\n /**\n * The ID of authenticated bot or user that is putting the issue comment.\n *\n * This drives our `put` behaviour, which tries to locate and edit an existing\n * comment before creating a new one. If this is not provided, the ID will be\n * inferred from the GitHub Users API.\n *\n * https://docs.github.com/en/rest/reference/users#get-the-authenticated-user\n *\n * If you're at SEEK and using BuildAgency's GitHub API integration, you may\n * use `'seek-build-agency'` as an optimisation to skip the user lookup.\n *\n * https://api.github.com/users/buildagencygitapitoken[bot]\n */\n userId?: number | 'seek-build-agency';\n}\n\ninterface IssueComment {\n id: number;\n}\n\n/**\n * Asynchronously creates or updates a GitHub issue comment.\n *\n * This emulates `put` behaviour by overwriting the first existing comment by\n * the same author on the issue, enabling use cases like a persistent bot\n * comment at the top of the pull request that reflects the current status of a\n * CI check.\n *\n * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be present\n * on the environment.\n */\nexport const putIssueComment = async (\n params: PutIssueCommentParameters,\n): Promise<IssueComment | null> => {\n if (params.body === null && !params.internalId) {\n // It's dangerous to just delete the first comment, as it may not be\n // from the current flow.\n throw new Error('Cannot remove comment without an internalId');\n }\n\n const env = params.env ?? process.env;\n\n const dir = process.cwd();\n\n const { owner, repo } = await Git.getOwnerAndRepo({ dir });\n\n const client = await createRestClient({ auth: apiTokenFromEnvironment() });\n\n const issueNumber =\n params.issueNumber ?? (await getPullRequestNumber({ client, env }));\n\n if (!issueNumber) {\n throw new Error('Failed to infer an issue number');\n }\n\n const comments = await client.issues.listComments({\n issue_number: issueNumber,\n owner,\n repo,\n });\n\n const userId: number =\n params.userId === 'seek-build-agency'\n ? // https://api.github.com/users/buildagencygitapitoken[bot]\n 87109344\n : (params.userId ?? (await getUserId(client)));\n\n const commentId = comments.data.find(\n (comment) =>\n comment.user?.id === userId &&\n (params.internalId\n ? comment.body?.endsWith(`\\n\\n<!-- ${params.internalId} -->`)\n : true),\n )?.id;\n\n if (params.body === null) {\n if (commentId) {\n await client.issues.deleteComment({\n comment_id: commentId,\n owner,\n repo,\n });\n }\n\n return null;\n }\n\n const body = params.internalId\n ? [params.body.trim(), `<!-- ${params.internalId} -->`].join('\\n\\n')\n : params.body.trim();\n\n const response = await (commentId\n ? client.issues.updateComment({\n body,\n comment_id: commentId,\n issue_number: issueNumber,\n owner,\n repo,\n })\n : client.issues.createComment({\n body,\n issue_number: issueNumber,\n owner,\n repo,\n }));\n\n return {\n id: response.data.id,\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,UAAqB;AAErB,yBAAwC;AACxC,qBAAiC;AACjC,yBAAqC;AAErC,MAAM,YAAY,OAAO,WAAqC;AAC5D,QAAM,EAAE,KAAK,IAAI,MAAM,OAAO,MAAM,iBAAiB;AAErD,SAAO,KAAK;AACd;AAmEO,MAAM,kBAAkB,OAC7B,WACiC;AACjC,MAAI,OAAO,SAAS,QAAQ,CAAC,OAAO,YAAY;AAG9C,UAAM,IAAI,MAAM,6CAA6C;AAAA,EAC/D;AAEA,QAAM,MAAM,OAAO,OAAO,QAAQ;AAElC,QAAM,MAAM,QAAQ,IAAI;AAExB,QAAM,EAAE,OAAO,KAAK,IAAI,MAAM,IAAI,gBAAgB,EAAE,IAAI,CAAC;AAEzD,QAAM,SAAS,UAAM,iCAAiB,EAAE,UAAM,4CAAwB,EAAE,CAAC;AAEzE,QAAM,cACJ,OAAO,eAAgB,UAAM,yCAAqB,EAAE,QAAQ,IAAI,CAAC;AAEnE,MAAI,CAAC,aAAa;AAChB,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AAEA,QAAM,WAAW,MAAM,OAAO,OAAO,aAAa;AAAA,IAChD,cAAc;AAAA,IACd;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,SACJ,OAAO,WAAW;AAAA;AAAA,IAEd;AAAA,MACC,OAAO,UAAW,MAAM,UAAU,MAAM;AAE/C,QAAM,YAAY,SAAS,KAAK;AAAA,IAC9B,CAAC,YACC,QAAQ,MAAM,OAAO,WACpB,OAAO,aACJ,QAAQ,MAAM,SAAS;AAAA;AAAA,OAAY,OAAO,UAAU,MAAM,IAC1D;AAAA,EACR,GAAG;AAEH,MAAI,OAAO,SAAS,MAAM;AACxB,QAAI,WAAW;AACb,YAAM,OAAO,OAAO,cAAc;AAAA,QAChC,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,OAAO,aAChB,CAAC,OAAO,KAAK,KAAK,GAAG,QAAQ,OAAO,UAAU,MAAM,EAAE,KAAK,MAAM,IACjE,OAAO,KAAK,KAAK;AAErB,QAAM,WAAW,OAAO,YACpB,OAAO,OAAO,cAAc;AAAA,IAC1B;AAAA,IACA,YAAY;AAAA,IACZ,cAAc;AAAA,IACd;AAAA,IACA;AAAA,EACF,CAAC,IACD,OAAO,OAAO,cAAc;AAAA,IAC1B;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,EACF,CAAC;AAEL,SAAO;AAAA,IACL,IAAI,SAAS,KAAK;AAAA,EACpB;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Octokit } from '@octokit/rest';
|
|
2
|
-
import type { RequestParameters } from '@octokit/types';
|
|
3
|
-
export declare const createRestClient: (options: {
|
|
4
|
-
auth: unknown;
|
|
5
|
-
}) => Promise<Octokit>;
|
|
6
|
-
export declare const graphql: <ResponseData>(query: string, parameters?: RequestParameters) => Promise<ResponseData>;
|
|
@@ -1,42 +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 octokit_exports = {};
|
|
30
|
-
__export(octokit_exports, {
|
|
31
|
-
createRestClient: () => createRestClient,
|
|
32
|
-
graphql: () => graphql
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(octokit_exports);
|
|
35
|
-
const createRestClient = async (options) => new (await import("@octokit/rest")).Octokit(options);
|
|
36
|
-
const graphql = async (query, parameters) => (await import("@octokit/graphql")).graphql(query, parameters);
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
createRestClient,
|
|
40
|
-
graphql
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=octokit.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/api/github/octokit.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Octokit } from '@octokit/rest';\nimport type { RequestParameters } from '@octokit/types';\n\nexport const createRestClient = async (options: {\n auth: unknown;\n}): Promise<Octokit> => new (await import('@octokit/rest')).Octokit(options);\n\nexport const graphql = async <ResponseData>(\n query: string,\n parameters?: RequestParameters,\n) =>\n (await import('@octokit/graphql')).graphql<ResponseData>(query, parameters);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,mBAAmB,OAAO,YAEf,KAAK,MAAM,OAAO,eAAe,GAAG,QAAQ,OAAO;AAEpE,MAAM,UAAU,OACrB,OACA,gBAEC,MAAM,OAAO,kBAAkB,GAAG,QAAsB,OAAO,UAAU;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Octokit } from '@octokit/rest' with { 'resolution-mode': 'import' };
|
|
2
|
-
interface GetPullRequestParameters {
|
|
3
|
-
/**
|
|
4
|
-
* A preconstructed Octokit client to interact with GitHub's APIs.
|
|
5
|
-
*
|
|
6
|
-
* A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be
|
|
7
|
-
* present on the environment if this is not provided.
|
|
8
|
-
*/
|
|
9
|
-
client?: Octokit;
|
|
10
|
-
env?: Record<string, string | undefined>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Gets the number of the current pull request.
|
|
14
|
-
*
|
|
15
|
-
* This tries to extract the pull request from common CI environment variables,
|
|
16
|
-
* and falls back to querying the GitHub Repos API for the latest pull request
|
|
17
|
-
* associated with the head commit. An error is thrown if there are no
|
|
18
|
-
* associated pull requests, or if they are all closed or locked.
|
|
19
|
-
*/
|
|
20
|
-
export declare const getPullRequestNumber: (params?: GetPullRequestParameters) => Promise<number>;
|
|
21
|
-
export {};
|