skuba 3.16.1 → 3.17.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/jest-preset.js +7 -24
  2. package/lib/api/git/commit.d.ts +15 -0
  3. package/lib/api/git/commit.js +31 -0
  4. package/lib/api/git/commit.js.map +1 -0
  5. package/lib/api/git/commitAllChanges.d.ts +12 -0
  6. package/lib/api/git/commitAllChanges.js +36 -0
  7. package/lib/api/git/commitAllChanges.js.map +1 -0
  8. package/lib/api/git/getChangedFiles.d.ts +14 -0
  9. package/lib/api/git/getChangedFiles.js +41 -0
  10. package/lib/api/git/getChangedFiles.js.map +1 -0
  11. package/lib/api/git/index.d.ts +7 -0
  12. package/lib/api/git/index.js +18 -0
  13. package/lib/api/git/index.js.map +1 -0
  14. package/lib/api/git/log.d.ts +12 -0
  15. package/lib/api/git/log.js +37 -0
  16. package/lib/api/git/log.js.map +1 -0
  17. package/lib/api/git/push.d.ts +43 -0
  18. package/lib/api/git/push.js +46 -0
  19. package/lib/api/git/push.js.map +1 -0
  20. package/lib/api/git/remote.d.ts +18 -0
  21. package/lib/api/git/remote.js +57 -0
  22. package/lib/api/git/remote.js.map +1 -0
  23. package/lib/api/git/reset.d.ts +12 -0
  24. package/lib/api/git/reset.js +39 -0
  25. package/lib/api/git/reset.js.map +1 -0
  26. package/lib/api/git/statusMatrix.d.ts +7 -0
  27. package/lib/api/git/statusMatrix.js +14 -0
  28. package/lib/api/git/statusMatrix.js.map +1 -0
  29. package/lib/api/github/checkRun.d.ts +27 -5
  30. package/lib/api/github/checkRun.js +29 -49
  31. package/lib/api/github/checkRun.js.map +1 -1
  32. package/lib/api/github/environment.d.ts +19 -0
  33. package/lib/api/github/environment.js +23 -2
  34. package/lib/api/github/environment.js.map +1 -1
  35. package/lib/api/github/index.d.ts +4 -0
  36. package/lib/api/github/index.js +9 -1
  37. package/lib/api/github/index.js.map +1 -1
  38. package/lib/api/github/issueComment.d.ts +59 -0
  39. package/lib/api/github/issueComment.js +96 -0
  40. package/lib/api/github/issueComment.js.map +1 -0
  41. package/lib/api/github/pullRequest.d.ts +21 -0
  42. package/lib/api/github/pullRequest.js +70 -0
  43. package/lib/api/github/pullRequest.js.map +1 -0
  44. package/lib/api/jest/index.d.ts +2 -2
  45. package/lib/api/jest/index.js.map +1 -1
  46. package/lib/api/net/waitFor.d.ts +1 -1
  47. package/lib/api/net/waitFor.js.map +1 -1
  48. package/lib/cli/adapter/eslint.d.ts +2 -2
  49. package/lib/cli/adapter/eslint.js.map +1 -1
  50. package/lib/cli/adapter/prettier.d.ts +22 -1
  51. package/lib/cli/adapter/prettier.js +44 -13
  52. package/lib/cli/adapter/prettier.js.map +1 -1
  53. package/lib/cli/configure/analyseConfiguration.d.ts +1 -1
  54. package/lib/cli/configure/analyseDependencies.d.ts +2 -2
  55. package/lib/cli/configure/analyseDependencies.js.map +1 -1
  56. package/lib/cli/configure/analysis/package.d.ts +1 -1
  57. package/lib/cli/configure/analysis/project.d.ts +1 -1
  58. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.d.ts +1 -1
  59. package/lib/cli/configure/dependencies/seekKoala.d.ts +1 -1
  60. package/lib/cli/configure/dependencies/skuba.d.ts +1 -1
  61. package/lib/cli/configure/dependencies/skubaDeps.d.ts +1 -1
  62. package/lib/cli/configure/dependencies/skubaDive.d.ts +1 -1
  63. package/lib/cli/configure/ensureTemplateCompletion.d.ts +2 -2
  64. package/lib/cli/configure/ensureTemplateCompletion.js.map +1 -1
  65. package/lib/cli/configure/getEntryPoint.d.ts +3 -3
  66. package/lib/cli/configure/getProjectType.d.ts +2 -2
  67. package/lib/cli/configure/modules/eslint.d.ts +1 -1
  68. package/lib/cli/configure/modules/ignore.d.ts +1 -1
  69. package/lib/cli/configure/modules/index.d.ts +1 -1
  70. package/lib/cli/configure/modules/jest.d.ts +1 -1
  71. package/lib/cli/configure/modules/nodemon.d.ts +1 -1
  72. package/lib/cli/configure/modules/package.d.ts +1 -1
  73. package/lib/cli/configure/modules/prettier.d.ts +1 -1
  74. package/lib/cli/configure/modules/renovate.d.ts +1 -1
  75. package/lib/cli/configure/modules/serverless.d.ts +1 -1
  76. package/lib/cli/configure/modules/skubaDive.d.ts +1 -1
  77. package/lib/cli/configure/modules/tsconfig.d.ts +1 -1
  78. package/lib/cli/configure/modules/tslint.d.ts +1 -1
  79. package/lib/cli/configure/processing/deleteFiles.d.ts +1 -1
  80. package/lib/cli/configure/processing/loadFiles.d.ts +1 -1
  81. package/lib/cli/configure/processing/package.d.ts +1 -1
  82. package/lib/cli/configure/processing/typescript.js +1 -1
  83. package/lib/cli/configure/processing/typescript.js.map +1 -1
  84. package/lib/cli/configure/types.d.ts +1 -1
  85. package/lib/cli/init/getConfig.d.ts +2 -2
  86. package/lib/cli/init/getConfig.js.map +1 -1
  87. package/lib/cli/init/git.js +22 -8
  88. package/lib/cli/init/git.js.map +1 -1
  89. package/lib/cli/init/writePackageJson.d.ts +1 -1
  90. package/lib/cli/lint/annotate/buildkite/eslint.d.ts +1 -1
  91. package/lib/cli/lint/annotate/buildkite/index.d.ts +3 -3
  92. package/lib/cli/lint/annotate/buildkite/prettier.d.ts +1 -1
  93. package/lib/cli/lint/annotate/buildkite/tsc.d.ts +1 -1
  94. package/lib/cli/lint/annotate/github/eslint.d.ts +2 -2
  95. package/lib/cli/lint/annotate/github/index.d.ts +3 -3
  96. package/lib/cli/lint/annotate/github/index.js +1 -2
  97. package/lib/cli/lint/annotate/github/index.js.map +1 -1
  98. package/lib/cli/lint/annotate/github/prettier.d.ts +2 -2
  99. package/lib/cli/lint/annotate/github/tsc.d.ts +2 -2
  100. package/lib/cli/lint/annotate/index.d.ts +3 -3
  101. package/lib/cli/lint/eslint.d.ts +1 -1
  102. package/lib/cli/lint/eslint.js.map +1 -1
  103. package/lib/cli/lint/prettier.d.ts +1 -1
  104. package/lib/cli/lint/prettier.js.map +1 -1
  105. package/lib/cli/node.js +1 -1
  106. package/lib/cli/node.js.map +1 -1
  107. package/lib/cli/start.js +1 -1
  108. package/lib/cli/start.js.map +1 -1
  109. package/lib/cli/{test.d.ts → test/index.d.ts} +0 -0
  110. package/lib/cli/{test.js → test/index.js} +4 -4
  111. package/lib/cli/test/index.js.map +1 -0
  112. package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
  113. package/lib/cli/test/reporters/github/annotations.js +86 -0
  114. package/lib/cli/test/reporters/github/annotations.js.map +1 -0
  115. package/lib/cli/test/reporters/github/index.d.ts +5 -0
  116. package/lib/cli/test/reporters/github/index.js +69 -0
  117. package/lib/cli/test/reporters/github/index.js.map +1 -0
  118. package/lib/index.d.ts +2 -1
  119. package/lib/index.js +3 -2
  120. package/lib/index.js.map +1 -1
  121. package/lib/utils/args.d.ts +1 -1
  122. package/lib/utils/exec.d.ts +2 -1
  123. package/lib/utils/exec.js.map +1 -1
  124. package/lib/utils/manifest.d.ts +2 -1
  125. package/lib/utils/manifest.js.map +1 -1
  126. package/package.json +10 -7
  127. package/template/express-rest-api/.buildkite/pipeline.yml +2 -0
  128. package/template/greeter/.buildkite/pipeline.yml +2 -0
  129. package/template/koa-rest-api/.buildkite/pipeline.yml +2 -0
  130. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +3 -1
  131. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +3 -1
  132. package/lib/cli/test.js.map +0 -1
  133. package/lib/register.d.ts +0 -20
  134. package/lib/register.js +0 -44
  135. package/lib/register.js.map +0 -1
package/jest-preset.js CHANGED
@@ -1,28 +1,14 @@
1
- const { defaults: tsJestDefaults } = require('ts-jest/presets');
1
+ const { defaults } = require('ts-jest/presets');
2
2
 
3
- const TS_JEST_NAME = 'ts-jest';
4
-
5
- /**
6
- * Resolved path of the `ts-jest` preset.
7
- *
8
- * This allows Jest to resolve the preset even if it is installed to a nested
9
- * `./node_modules/skuba/node_modules/ts-jest` directory.
10
- */
11
- const TS_JEST_PATH = require.resolve(TS_JEST_NAME);
12
-
13
- // Rewrite `ts-jest` transformations using our resolved `TS_JEST_PATH`.
14
- const tsJestTransform = Object.fromEntries(
15
- Object.entries(tsJestDefaults.transform).map(([key, value]) => [
16
- key,
17
- value === TS_JEST_NAME ? TS_JEST_PATH : value,
18
- ]),
19
- );
3
+ const { createModuleNameMapper } = require('./jest/moduleNameMapper');
4
+ const { transform } = require('./jest/transform');
20
5
 
21
6
  /** @type {import('@jest/types').Config.InitialOptions} */
22
7
  module.exports = {
23
- ...tsJestDefaults,
8
+ ...defaults,
24
9
 
25
- transform: tsJestTransform,
10
+ moduleNameMapper: createModuleNameMapper(),
11
+ transform,
26
12
 
27
13
  collectCoverageFrom: [
28
14
  '**/*.ts',
@@ -35,13 +21,10 @@ module.exports = {
35
21
  '!<rootDir>/jest.*.ts',
36
22
  ],
37
23
  coverageDirectory: 'coverage',
38
- moduleNameMapper: {
39
- '^src$': '<rootDir>/src',
40
- '^src/(.+)$': '<rootDir>/src/$1',
41
- },
42
24
  testEnvironment: 'node',
43
25
  testPathIgnorePatterns: [
44
26
  '/node_modules.*/',
45
27
  '<rootDir>/(coverage|dist|lib|tmp).*/',
46
28
  ],
29
+ reporters: ['default', require.resolve('./lib/cli/test/reporters/github')],
47
30
  };
@@ -0,0 +1,15 @@
1
+ export interface Identity {
2
+ email?: string;
3
+ name?: string;
4
+ }
5
+ interface CommitParameters {
6
+ author?: Identity;
7
+ committer?: Identity;
8
+ dir: string;
9
+ message: string;
10
+ }
11
+ /**
12
+ * Writes a commit to the local Git repository.
13
+ */
14
+ export declare const commit: ({ author, committer, dir, message, }: CommitParameters) => Promise<string>;
15
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.commit = void 0;
16
+ const fs_extra_1 = __importDefault(require("fs-extra"));
17
+ const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
18
+ /**
19
+ * Writes a commit to the local Git repository.
20
+ */
21
+ const commit = ({ author = { name: 'skuba' }, committer = { name: 'skuba' }, dir, message, }) => __awaiter(void 0, void 0, void 0, function* () {
22
+ return isomorphic_git_1.default.commit({
23
+ author,
24
+ committer,
25
+ dir,
26
+ fs: fs_extra_1.default,
27
+ message,
28
+ });
29
+ });
30
+ exports.commit = commit;
31
+ //# sourceMappingURL=commit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit.js","sourceRoot":"","sources":["../../../src/api/git/commit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,oEAAiC;AAcjC;;GAEG;AACI,MAAM,MAAM,GAAG,CAAO,EAC3B,MAAM,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAC1B,SAAS,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAC7B,GAAG,EACH,OAAO,GACU,EAAmB,EAAE;IACtC,OAAA,wBAAG,CAAC,MAAM,CAAC;QACT,MAAM;QACN,SAAS;QACT,GAAG;QACH,EAAE,EAAF,kBAAE;QACF,OAAO;KACR,CAAC,CAAA;EAAA,CAAC;AAZQ,QAAA,MAAM,UAYd"}
@@ -0,0 +1,12 @@
1
+ import type { Identity } from './commit';
2
+ interface CommitAllParameters {
3
+ dir: string;
4
+ message: string;
5
+ author?: Identity;
6
+ committer?: Identity;
7
+ }
8
+ /**
9
+ * Stages all changes and writes a commit to the local Git repository.
10
+ */
11
+ export declare const commitAllChanges: ({ dir, message, author, committer, }: CommitAllParameters) => Promise<void>;
12
+ export {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.commitAllChanges = void 0;
16
+ const fs_extra_1 = __importDefault(require("fs-extra"));
17
+ const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
18
+ const commit_1 = require("./commit");
19
+ const getChangedFiles_1 = require("./getChangedFiles");
20
+ /**
21
+ * Stages all changes and writes a commit to the local Git repository.
22
+ */
23
+ const commitAllChanges = ({ dir, message, author, committer, }) => __awaiter(void 0, void 0, void 0, function* () {
24
+ const changedFiles = yield (0, getChangedFiles_1.getChangedFiles)({ dir });
25
+ yield Promise.all(changedFiles.map((file) => file.state === 'deleted'
26
+ ? isomorphic_git_1.default.remove({ fs: fs_extra_1.default, dir, filepath: file.path })
27
+ : isomorphic_git_1.default.add({ fs: fs_extra_1.default, dir, filepath: file.path })));
28
+ yield (0, commit_1.commit)({
29
+ dir,
30
+ message,
31
+ author,
32
+ committer,
33
+ });
34
+ });
35
+ exports.commitAllChanges = commitAllChanges;
36
+ //# sourceMappingURL=commitAllChanges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commitAllChanges.js","sourceRoot":"","sources":["../../../src/api/git/commitAllChanges.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,oEAAiC;AAEjC,qCAAkC;AAElC,uDAAoD;AASpD;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAO,EACrC,GAAG,EACH,OAAO,EACP,MAAM,EACN,SAAS,GACW,EAAiB,EAAE;IACvC,MAAM,YAAY,GAAG,MAAM,IAAA,iCAAe,EAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACpD,MAAM,OAAO,CAAC,GAAG,CACf,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACxB,IAAI,CAAC,KAAK,KAAK,SAAS;QACtB,CAAC,CAAC,wBAAG,CAAC,MAAM,CAAC,EAAE,EAAE,EAAF,kBAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9C,CAAC,CAAC,wBAAG,CAAC,GAAG,CAAC,EAAE,EAAE,EAAF,kBAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAC9C,CACF,CAAC;IAEF,MAAM,IAAA,eAAM,EAAC;QACX,GAAG;QACH,OAAO;QACP,MAAM;QACN,SAAS;KACV,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AArBW,QAAA,gBAAgB,oBAqB3B"}
@@ -0,0 +1,14 @@
1
+ declare type ChangedFileState = 'added' | 'modified' | 'deleted';
2
+ export interface ChangedFile {
3
+ path: string;
4
+ state: ChangedFileState;
5
+ }
6
+ interface ChangedFilesParameters {
7
+ dir: string;
8
+ }
9
+ /**
10
+ * Returns all the files which have been added, modified or deleted in the
11
+ * working directory of the local Git repository since the last commit.
12
+ */
13
+ export declare const getChangedFiles: ({ dir, }: ChangedFilesParameters) => Promise<ChangedFile[]>;
14
+ export {};
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getChangedFiles = void 0;
16
+ const fs_extra_1 = __importDefault(require("fs-extra"));
17
+ const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
18
+ const statusMatrix_1 = require("./statusMatrix");
19
+ const mapState = (row) => {
20
+ if (row[statusMatrix_1.HEAD] === statusMatrix_1.ABSENT) {
21
+ return 'added';
22
+ }
23
+ if (row[statusMatrix_1.WORKDIR] === statusMatrix_1.MODIFIED) {
24
+ return 'modified';
25
+ }
26
+ return 'deleted';
27
+ };
28
+ /**
29
+ * Returns all the files which have been added, modified or deleted in the
30
+ * working directory of the local Git repository since the last commit.
31
+ */
32
+ const getChangedFiles = ({ dir, }) => __awaiter(void 0, void 0, void 0, function* () {
33
+ const allFiles = yield isomorphic_git_1.default.statusMatrix({ fs: fs_extra_1.default, dir });
34
+ return allFiles
35
+ .filter((row) => row[statusMatrix_1.HEAD] !== statusMatrix_1.UNMODIFIED ||
36
+ row[statusMatrix_1.WORKDIR] !== statusMatrix_1.UNMODIFIED ||
37
+ row[statusMatrix_1.STAGE] !== statusMatrix_1.UNMODIFIED)
38
+ .map((row) => ({ path: row[statusMatrix_1.FILEPATH], state: mapState(row) }));
39
+ });
40
+ exports.getChangedFiles = getChangedFiles;
41
+ //# sourceMappingURL=getChangedFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getChangedFiles.js","sourceRoot":"","sources":["../../../src/api/git/getChangedFiles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,oEAAiC;AAEjC,iDAQwB;AAWxB,MAAM,QAAQ,GAAG,CACf,GAA8C,EAC5B,EAAE;IACpB,IAAI,GAAG,CAAC,mBAAI,CAAC,KAAK,qBAAM,EAAE;QACxB,OAAO,OAAO,CAAC;KAChB;IAED,IAAI,GAAG,CAAC,sBAAO,CAAC,KAAK,uBAAQ,EAAE;QAC7B,OAAO,UAAU,CAAC;KACnB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,eAAe,GAAG,CAAO,EACpC,GAAG,GACoB,EAA0B,EAAE;IACnD,MAAM,QAAQ,GAAG,MAAM,wBAAG,CAAC,YAAY,CAAC,EAAE,EAAE,EAAF,kBAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IACrD,OAAO,QAAQ;SACZ,MAAM,CACL,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,mBAAI,CAAC,KAAK,yBAAU;QACxB,GAAG,CAAC,sBAAO,CAAC,KAAK,yBAAU;QAC3B,GAAG,CAAC,oBAAK,CAAC,KAAK,yBAAU,CAC5B;SACA,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,uBAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AACnE,CAAC,CAAA,CAAC;AAZW,QAAA,eAAe,mBAY1B"}
@@ -0,0 +1,7 @@
1
+ export { commit } from './commit';
2
+ export { commitAllChanges } from './commitAllChanges';
3
+ export { getChangedFiles } from './getChangedFiles';
4
+ export { getHeadCommitId } from './log';
5
+ export { getOwnerAndRepo } from './remote';
6
+ export { push } from './push';
7
+ export { reset } from './reset';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reset = exports.push = exports.getOwnerAndRepo = exports.getHeadCommitId = exports.getChangedFiles = exports.commitAllChanges = exports.commit = void 0;
4
+ var commit_1 = require("./commit");
5
+ Object.defineProperty(exports, "commit", { enumerable: true, get: function () { return commit_1.commit; } });
6
+ var commitAllChanges_1 = require("./commitAllChanges");
7
+ Object.defineProperty(exports, "commitAllChanges", { enumerable: true, get: function () { return commitAllChanges_1.commitAllChanges; } });
8
+ var getChangedFiles_1 = require("./getChangedFiles");
9
+ Object.defineProperty(exports, "getChangedFiles", { enumerable: true, get: function () { return getChangedFiles_1.getChangedFiles; } });
10
+ var log_1 = require("./log");
11
+ Object.defineProperty(exports, "getHeadCommitId", { enumerable: true, get: function () { return log_1.getHeadCommitId; } });
12
+ var remote_1 = require("./remote");
13
+ Object.defineProperty(exports, "getOwnerAndRepo", { enumerable: true, get: function () { return remote_1.getOwnerAndRepo; } });
14
+ var push_1 = require("./push");
15
+ Object.defineProperty(exports, "push", { enumerable: true, get: function () { return push_1.push; } });
16
+ var reset_1 = require("./reset");
17
+ Object.defineProperty(exports, "reset", { enumerable: true, get: function () { return reset_1.reset; } });
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/git/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,6BAAwC;AAA/B,sGAAA,eAAe,OAAA;AACxB,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AACxB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,iCAAgC;AAAvB,8FAAA,KAAK,OAAA"}
@@ -0,0 +1,12 @@
1
+ interface GetHeadCommitIdParameters {
2
+ dir: string;
3
+ env?: Record<string, string | undefined>;
4
+ }
5
+ /**
6
+ * Gets the object ID of the head commit.
7
+ *
8
+ * This tries to extract the commit ID from common CI environment variables,
9
+ * and falls back to the local Git repository log.
10
+ */
11
+ export declare const getHeadCommitId: ({ dir, env, }: GetHeadCommitIdParameters) => Promise<string>;
12
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getHeadCommitId = void 0;
16
+ const fs_extra_1 = __importDefault(require("fs-extra"));
17
+ const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
18
+ /**
19
+ * Gets the object ID of the head commit.
20
+ *
21
+ * This tries to extract the commit ID from common CI environment variables,
22
+ * and falls back to the local Git repository log.
23
+ */
24
+ const getHeadCommitId = ({ dir, env = process.env, }) => __awaiter(void 0, void 0, void 0, function* () {
25
+ var _a;
26
+ const oidFromEnv = (_a = env.BUILDKITE_COMMIT) !== null && _a !== void 0 ? _a : env.GITHUB_SHA;
27
+ if (oidFromEnv) {
28
+ return oidFromEnv;
29
+ }
30
+ const [headCommit] = yield isomorphic_git_1.default.log({ depth: 1, dir, fs: fs_extra_1.default });
31
+ if (!headCommit) {
32
+ throw new Error('Git log does not contain any commits');
33
+ }
34
+ return headCommit.oid;
35
+ });
36
+ exports.getHeadCommitId = getHeadCommitId;
37
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/api/git/log.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,oEAAiC;AAOjC;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAO,EACpC,GAAG,EACH,GAAG,GAAG,OAAO,CAAC,GAAG,GACS,EAAmB,EAAE;;IAC/C,MAAM,UAAU,GAAG,MAAA,GAAG,CAAC,gBAAgB,mCAAI,GAAG,CAAC,UAAU,CAAC;IAE1D,IAAI,UAAU,EAAE;QACd,OAAO,UAAU,CAAC;KACnB;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,wBAAG,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAF,kBAAE,EAAE,CAAC,CAAC;IAE1D,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;KACzD;IAED,OAAO,UAAU,CAAC,GAAG,CAAC;AACxB,CAAC,CAAA,CAAC;AAjBW,QAAA,eAAe,mBAiB1B"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Use a GitHub app token to auth the Git push.
3
+ *
4
+ * This defaults to the `GITHUB_API_TOKEN` and `GITHUB_TOKEN` environment
5
+ * variables if `token` is not provided.
6
+ */
7
+ interface GitHubAppAuth {
8
+ type: 'gitHubApp';
9
+ token?: string;
10
+ }
11
+ interface PushParameters {
12
+ /**
13
+ * The auth mechanism for the push.
14
+ *
15
+ * Currently, only GitHub app tokens are supported.
16
+ */
17
+ auth: GitHubAppAuth;
18
+ dir: string;
19
+ /**
20
+ * The reference to push to the remote.
21
+ *
22
+ * This may be a commit, branch or tag in the local repository.
23
+ */
24
+ ref: string;
25
+ remote?: string;
26
+ /**
27
+ * The destination branch or tag on the remote.
28
+ *
29
+ * This defaults to `ref`.
30
+ */
31
+ remoteRef?: string;
32
+ /**
33
+ * Forcefully override any conflicts.
34
+ *
35
+ * This defaults to `false`.
36
+ */
37
+ force?: boolean;
38
+ }
39
+ /**
40
+ * Pushes the specified `ref` from the local Git repository to a remote.
41
+ */
42
+ export declare const push: ({ auth, dir, ref, remote, remoteRef, force, }: PushParameters) => Promise<import("isomorphic-git").PushResult>;
43
+ export {};
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.push = void 0;
16
+ const fs_extra_1 = __importDefault(require("fs-extra"));
17
+ const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
18
+ const node_1 = __importDefault(require("isomorphic-git/http/node"));
19
+ const environment_1 = require("../github/environment");
20
+ const remote_1 = require("./remote");
21
+ /**
22
+ * Pushes the specified `ref` from the local Git repository to a remote.
23
+ */
24
+ const push = ({ auth, dir, ref, remote, remoteRef, force, }) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const { owner, repo } = yield (0, remote_1.getOwnerAndRepo)({ dir });
26
+ const url = `https://github.com/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`;
27
+ return isomorphic_git_1.default.push({
28
+ onAuth: () => {
29
+ var _a;
30
+ return ({
31
+ username: 'x-access-token',
32
+ password: (_a = auth.token) !== null && _a !== void 0 ? _a : (0, environment_1.apiTokenFromEnvironment)(),
33
+ });
34
+ },
35
+ dir,
36
+ fs: fs_extra_1.default,
37
+ http: node_1.default,
38
+ ref,
39
+ remote,
40
+ remoteRef,
41
+ url,
42
+ force,
43
+ });
44
+ });
45
+ exports.push = push;
46
+ //# sourceMappingURL=push.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.js","sourceRoot":"","sources":["../../../src/api/git/push.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,oEAAiC;AACjC,oEAA4C;AAE5C,uDAAgE;AAEhE,qCAA2C;AA+C3C;;GAEG;AACI,MAAM,IAAI,GAAG,CAAO,EACzB,IAAI,EACJ,GAAG,EACH,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,GACU,EAAE,EAAE;IACnB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,wBAAe,EAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAEvD,MAAM,GAAG,GAAG,sBAAsB,kBAAkB,CAClD,KAAK,CACN,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;IAEhC,OAAO,wBAAG,CAAC,IAAI,CAAC;QACd,MAAM,EAAE,GAAG,EAAE;;YAAC,OAAA,CAAC;gBACb,QAAQ,EAAE,gBAAgB;gBAC1B,QAAQ,EAAE,MAAA,IAAI,CAAC,KAAK,mCAAI,IAAA,qCAAuB,GAAE;aAClD,CAAC,CAAA;SAAA;QACF,GAAG;QACH,EAAE,EAAF,kBAAE;QACF,IAAI,EAAJ,cAAI;QACJ,GAAG;QACH,MAAM;QACN,SAAS;QACT,GAAG;QACH,KAAK;KACN,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AA5BW,QAAA,IAAI,QA4Bf"}
@@ -0,0 +1,18 @@
1
+ interface GetOwnerAndRepoParameters {
2
+ dir: string;
3
+ }
4
+ /**
5
+ * Extracts the owner and repository names from local Git remotes.
6
+ *
7
+ * Currently, only GitHub repository URLs are supported:
8
+ *
9
+ * ```console
10
+ * git@github.com:seek-oss/skuba.git
11
+ * https://github.com/seek-oss/skuba.git
12
+ * ```
13
+ */
14
+ export declare const getOwnerAndRepo: ({ dir, }: GetOwnerAndRepoParameters) => Promise<{
15
+ owner: string;
16
+ repo: string;
17
+ }>;
18
+ export {};
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getOwnerAndRepo = void 0;
16
+ const fs_extra_1 = __importDefault(require("fs-extra"));
17
+ const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
18
+ /**
19
+ * Matches the owner and repository names in a GitHub repository URL.
20
+ *
21
+ * For example, given the following input strings:
22
+ *
23
+ * ```console
24
+ * git@github.com:seek-oss/skuba.git
25
+ * https://github.com/seek-oss/skuba.git
26
+ * ```
27
+ *
28
+ * This pattern will produce the following matches:
29
+ *
30
+ * 1. seek-oss
31
+ * 2. skuba
32
+ */
33
+ const ownerRepoRegex = /github.com(?::|\/)(.+)\/(.+).git$/;
34
+ /**
35
+ * Extracts the owner and repository names from local Git remotes.
36
+ *
37
+ * Currently, only GitHub repository URLs are supported:
38
+ *
39
+ * ```console
40
+ * git@github.com:seek-oss/skuba.git
41
+ * https://github.com/seek-oss/skuba.git
42
+ * ```
43
+ */
44
+ const getOwnerAndRepo = ({ dir, }) => __awaiter(void 0, void 0, void 0, function* () {
45
+ const remotes = yield isomorphic_git_1.default.listRemotes({ dir, fs: fs_extra_1.default });
46
+ for (const { url } of remotes) {
47
+ const match = ownerRepoRegex.exec(url);
48
+ const owner = match === null || match === void 0 ? void 0 : match[1];
49
+ const repo = match === null || match === void 0 ? void 0 : match[2];
50
+ if (owner && repo) {
51
+ return { owner, repo };
52
+ }
53
+ }
54
+ throw new Error('Could not find a GitHub remote');
55
+ });
56
+ exports.getOwnerAndRepo = getOwnerAndRepo;
57
+ //# sourceMappingURL=remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.js","sourceRoot":"","sources":["../../../src/api/git/remote.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,oEAAiC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,MAAM,cAAc,GAAG,mCAAmC,CAAC;AAM3D;;;;;;;;;GASG;AACI,MAAM,eAAe,GAAG,CAAO,EACpC,GAAG,GACuB,EAA4C,EAAE;IACxE,MAAM,OAAO,GAAG,MAAM,wBAAG,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,EAAE,EAAF,kBAAE,EAAE,CAAC,CAAC;IAEnD,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,OAAO,EAAE;QAC7B,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEvC,MAAM,KAAK,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,CAAC;QAExB,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SACxB;KACF;IAED,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC,CAAA,CAAC;AAjBW,QAAA,eAAe,mBAiB1B"}
@@ -0,0 +1,12 @@
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 {};
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.reset = void 0;
16
+ const path_1 = __importDefault(require("path"));
17
+ const fs_extra_1 = __importDefault(require("fs-extra"));
18
+ const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
19
+ const statusMatrix_1 = require("./statusMatrix");
20
+ /**
21
+ * Resets the specified branch in the local Git repository to a particular
22
+ * commit.
23
+ */
24
+ const reset = ({ dir, branch, commitId, hard, }) => __awaiter(void 0, void 0, void 0, function* () {
25
+ yield fs_extra_1.default.promises.writeFile(path_1.default.join(dir, '.git/refs/heads', branch), `${commitId}\n`);
26
+ if (hard) {
27
+ const allFiles = yield isomorphic_git_1.default.statusMatrix({ dir, fs: fs_extra_1.default });
28
+ // Get all files which have been modified or staged - does not include new untracked files or deleted files
29
+ const modifiedFiles = allFiles
30
+ .filter((row) => row[statusMatrix_1.WORKDIR] > statusMatrix_1.UNMODIFIED && row[statusMatrix_1.STAGE] > statusMatrix_1.UNMODIFIED)
31
+ .map((row) => row[statusMatrix_1.FILEPATH]);
32
+ // Delete modified/staged files
33
+ yield Promise.all(modifiedFiles.map((filePath) => fs_extra_1.default.promises.rm(filePath)));
34
+ // This will bring in the unmodified versions of files plus any files which were deleted
35
+ yield isomorphic_git_1.default.checkout({ dir, fs: fs_extra_1.default, ref: branch, force: true });
36
+ }
37
+ });
38
+ exports.reset = reset;
39
+ //# sourceMappingURL=reset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset.js","sourceRoot":"","sources":["../../../src/api/git/reset.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAC1B,oEAAiC;AAEjC,iDAAsE;AAStE;;;GAGG;AACI,MAAM,KAAK,GAAG,CAAO,EAC1B,GAAG,EACH,MAAM,EACN,QAAQ,EACR,IAAI,GACY,EAAiB,EAAE;IACnC,MAAM,kBAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,EAAE,MAAM,CAAC,EACzC,GAAG,QAAQ,IAAI,CAChB,CAAC;IAEF,IAAI,IAAI,EAAE;QACR,MAAM,QAAQ,GAAG,MAAM,wBAAG,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,EAAE,EAAF,kBAAE,EAAE,CAAC,CAAC;QACrD,2GAA2G;QAC3G,MAAM,aAAa,GAAG,QAAQ;aAC3B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,sBAAO,CAAC,GAAG,yBAAU,IAAI,GAAG,CAAC,oBAAK,CAAC,GAAG,yBAAU,CAAC;aACrE,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,uBAAQ,CAAC,CAAC,CAAC;QAE/B,+BAA+B;QAC/B,MAAM,OAAO,CAAC,GAAG,CACf,aAAa,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,kBAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAC1D,CAAC;QAEF,wFAAwF;QACxF,MAAM,wBAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,EAAE,EAAF,kBAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;KAC3D;AACH,CAAC,CAAA,CAAC;AA1BW,QAAA,KAAK,SA0BhB"}
@@ -0,0 +1,7 @@
1
+ export declare const FILEPATH = 0;
2
+ export declare const HEAD = 1;
3
+ export declare const WORKDIR = 2;
4
+ export declare const STAGE = 3;
5
+ export declare const ABSENT = 0;
6
+ export declare const UNMODIFIED = 1;
7
+ export declare const MODIFIED = 2;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // Based off https://isomorphic-git.org/docs/en/statusMatrix.html
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MODIFIED = exports.UNMODIFIED = exports.ABSENT = exports.STAGE = exports.WORKDIR = exports.HEAD = exports.FILEPATH = void 0;
5
+ // Status matrix row indexes
6
+ exports.FILEPATH = 0;
7
+ exports.HEAD = 1;
8
+ exports.WORKDIR = 2;
9
+ exports.STAGE = 3;
10
+ // Status matrix state
11
+ exports.ABSENT = 0;
12
+ exports.UNMODIFIED = 1;
13
+ exports.MODIFIED = 2;
14
+ //# sourceMappingURL=statusMatrix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statusMatrix.js","sourceRoot":"","sources":["../../../src/api/git/statusMatrix.ts"],"names":[],"mappings":";AAAA,iEAAiE;;;AAEjE,4BAA4B;AACf,QAAA,QAAQ,GAAG,CAAC,CAAC;AACb,QAAA,IAAI,GAAG,CAAC,CAAC;AACT,QAAA,OAAO,GAAG,CAAC,CAAC;AACZ,QAAA,KAAK,GAAG,CAAC,CAAC;AAEvB,sBAAsB;AACT,QAAA,MAAM,GAAG,CAAC,CAAC;AACX,QAAA,UAAU,GAAG,CAAC,CAAC;AACf,QAAA,QAAQ,GAAG,CAAC,CAAC"}
@@ -1,22 +1,44 @@
1
- import { Endpoints } from '@octokit/types';
1
+ import type { Endpoints } from '@octokit/types';
2
2
  declare type Output = NonNullable<Endpoints['POST /repos/{owner}/{repo}/check-runs']['parameters']['output']>;
3
3
  export declare type Annotation = NonNullable<Output['annotations']>[number];
4
+ /**
5
+ * {@link https://docs.github.com/en/rest/reference/checks#create-a-check-run}
6
+ */
4
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
+ */
5
13
  annotations: Annotation[];
14
+ /**
15
+ * The final conclusion of the check.
16
+ */
6
17
  conclusion: 'failure' | 'success';
18
+ /**
19
+ * The name of the check. For example, "code-coverage".
20
+ */
7
21
  name: string;
22
+ /**
23
+ * The summary of the check run. This parameter supports Markdown.
24
+ */
8
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
+ */
9
33
  title: string;
10
34
  }
11
35
  /**
12
- * Asynchronously creates a GitHub [check run] with annotations.
36
+ * Asynchronously creates a GitHub check run with annotations.
13
37
  *
14
38
  * The first 50 `annotations` are written in full to GitHub.
15
39
  *
16
40
  * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission
17
41
  * must be present on the environment.
18
-
19
-
20
42
  */
21
- export declare const createCheckRun: ({ annotations, conclusion, name, summary, title, }: CreateCheckRunParameters) => Promise<void>;
43
+ export declare const createCheckRun: ({ annotations, conclusion, name, summary, text, title, }: CreateCheckRunParameters) => Promise<void>;
22
44
  export {};