skuba 4.2.2 → 4.3.1

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 (72) hide show
  1. package/README.md +1 -1
  2. package/jest-preset.js +5 -1
  3. package/lib/api/git/index.d.ts +1 -0
  4. package/lib/api/git/index.js +3 -1
  5. package/lib/api/git/index.js.map +1 -1
  6. package/lib/api/git/pull.d.ts +35 -0
  7. package/lib/api/git/pull.js +34 -0
  8. package/lib/api/git/pull.js.map +1 -0
  9. package/lib/api/github/index.d.ts +1 -0
  10. package/lib/api/github/index.js +5 -1
  11. package/lib/api/github/index.js.map +1 -1
  12. package/lib/api/github/push.d.ts +73 -0
  13. package/lib/api/github/push.js +148 -0
  14. package/lib/api/github/push.js.map +1 -0
  15. package/lib/api/jest/index.d.ts +20 -20
  16. package/lib/cli/configure/analyseDependencies.js +1 -2
  17. package/lib/cli/configure/analyseDependencies.js.map +1 -1
  18. package/lib/cli/configure/analysis/diff.d.ts +1 -1
  19. package/lib/cli/configure/analysis/package.d.ts +1 -1
  20. package/lib/cli/configure/processing/ignoreFile.d.ts +1 -1
  21. package/lib/cli/configure/processing/javascript.d.ts +1 -1
  22. package/lib/cli/configure/processing/json.d.ts +1 -1
  23. package/lib/cli/configure/processing/package.d.ts +12 -12
  24. package/lib/cli/lint/autofix.js +24 -13
  25. package/lib/cli/lint/autofix.js.map +1 -1
  26. package/lib/cli/lint/external.d.ts +1 -0
  27. package/lib/cli/test/reporters/github/annotations.js +23 -8
  28. package/lib/cli/test/reporters/github/annotations.js.map +1 -1
  29. package/lib/utils/args.d.ts +1 -1
  30. package/lib/utils/error.d.ts +1 -1
  31. package/lib/utils/version.d.ts +1 -0
  32. package/lib/utils/version.js +11 -3
  33. package/lib/utils/version.js.map +1 -1
  34. package/lib/wrapper/http.d.ts +1 -1
  35. package/package.json +46 -17
  36. package/template/express-rest-api/.buildkite/pipeline.yml +4 -4
  37. package/template/express-rest-api/.gantry/common.yml +1 -1
  38. package/template/express-rest-api/Dockerfile +1 -1
  39. package/template/express-rest-api/Dockerfile.dev-deps +1 -1
  40. package/template/express-rest-api/README.md +11 -14
  41. package/template/express-rest-api/gantry.apply.yml +2 -0
  42. package/template/express-rest-api/gantry.build.yml +2 -0
  43. package/template/express-rest-api/package.json +1 -1
  44. package/template/greeter/.buildkite/pipeline.yml +1 -1
  45. package/template/greeter/Dockerfile +1 -1
  46. package/template/greeter/README.md +12 -15
  47. package/template/koa-rest-api/.buildkite/pipeline.yml +4 -4
  48. package/template/koa-rest-api/.gantry/common.yml +1 -1
  49. package/template/koa-rest-api/Dockerfile +1 -1
  50. package/template/koa-rest-api/Dockerfile.dev-deps +1 -1
  51. package/template/koa-rest-api/README.md +11 -14
  52. package/template/koa-rest-api/gantry.apply.yml +2 -0
  53. package/template/koa-rest-api/gantry.build.yml +2 -0
  54. package/template/koa-rest-api/package.json +6 -6
  55. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +2 -3
  56. package/template/lambda-sqs-worker/Dockerfile +1 -1
  57. package/template/lambda-sqs-worker/README.md +10 -13
  58. package/template/lambda-sqs-worker/package.json +1 -1
  59. package/template/lambda-sqs-worker/serverless.yml +0 -3
  60. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  61. package/template/lambda-sqs-worker-cdk/Dockerfile +1 -1
  62. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +6 -0
  63. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -0
  64. package/template/oss-npm-package/README.md +9 -11
  65. package/template/private-npm-package/README.md +6 -12
  66. package/template/express-rest-api/.me +0 -22
  67. package/template/greeter/.me +0 -20
  68. package/template/koa-rest-api/.me +0 -22
  69. package/template/lambda-sqs-worker/.me +0 -22
  70. package/template/lambda-sqs-worker-cdk/.me +0 -22
  71. package/template/oss-npm-package/.me +0 -21
  72. package/template/private-npm-package/.me +0 -21
package/README.md CHANGED
@@ -17,7 +17,7 @@
17
17
  - Deploy with [Gantry], [Serverless] or the [AWS CDK]
18
18
 
19
19
  [aws cdk]: https://docs.aws.amazon.com/cdk/latest/guide/work-with-cdk-typescript.html
20
- [gantry]: https://gantry.ssod.skinfra.xyz
20
+ [gantry]: https://backstage.myseek.xyz/docs/default/component/gantry/
21
21
  [serverless]: https://serverless.com/
22
22
 
23
23
  It provides you with:
package/jest-preset.js CHANGED
@@ -21,10 +21,14 @@ module.exports = {
21
21
  '!<rootDir>/jest.*.ts',
22
22
  ],
23
23
  coverageDirectory: 'coverage',
24
+ reporters: ['default', require.resolve('./lib/cli/test/reporters/github')],
24
25
  testEnvironment: 'node',
25
26
  testPathIgnorePatterns: [
26
27
  '/node_modules.*/',
27
28
  '<rootDir>/(coverage|dist|lib|tmp).*/',
28
29
  ],
29
- reporters: ['default', require.resolve('./lib/cli/test/reporters/github')],
30
+ watchPlugins: [
31
+ require.resolve('jest-watch-typeahead/filename'),
32
+ require.resolve('jest-watch-typeahead/testname'),
33
+ ],
30
34
  };
@@ -5,4 +5,5 @@ export { getChangedFiles } from './getChangedFiles';
5
5
  export { getHeadCommitId, getHeadCommitMessage } from './log';
6
6
  export { getOwnerAndRepo } from './remote';
7
7
  export { push } from './push';
8
+ export { fastForwardBranch } from './pull';
8
9
  export { reset } from './reset';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reset = exports.push = exports.getOwnerAndRepo = exports.getHeadCommitMessage = exports.getHeadCommitId = exports.getChangedFiles = exports.currentBranch = exports.commitAllChanges = exports.commit = void 0;
3
+ exports.reset = exports.fastForwardBranch = exports.push = exports.getOwnerAndRepo = exports.getHeadCommitMessage = exports.getHeadCommitId = exports.getChangedFiles = exports.currentBranch = exports.commitAllChanges = exports.commit = void 0;
4
4
  var commit_1 = require("./commit");
5
5
  Object.defineProperty(exports, "commit", { enumerable: true, get: function () { return commit_1.commit; } });
6
6
  var commitAllChanges_1 = require("./commitAllChanges");
@@ -16,6 +16,8 @@ var remote_1 = require("./remote");
16
16
  Object.defineProperty(exports, "getOwnerAndRepo", { enumerable: true, get: function () { return remote_1.getOwnerAndRepo; } });
17
17
  var push_1 = require("./push");
18
18
  Object.defineProperty(exports, "push", { enumerable: true, get: function () { return push_1.push; } });
19
+ var pull_1 = require("./pull");
20
+ Object.defineProperty(exports, "fastForwardBranch", { enumerable: true, get: function () { return pull_1.fastForwardBranch; } });
19
21
  var reset_1 = require("./reset");
20
22
  Object.defineProperty(exports, "reset", { enumerable: true, get: function () { return reset_1.reset; } });
21
23
  //# sourceMappingURL=index.js.map
@@ -1 +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,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,6BAA8D;AAArD,sGAAA,eAAe,OAAA;AAAE,2GAAA,oBAAoB,OAAA;AAC9C,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AACxB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,iCAAgC;AAAvB,8FAAA,KAAK,OAAA"}
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,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,6BAA8D;AAArD,sGAAA,eAAe,OAAA;AAAE,2GAAA,oBAAoB,OAAA;AAC9C,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AACxB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,+BAA2C;AAAlC,yGAAA,iBAAiB,OAAA;AAC1B,iCAAgC;AAAvB,8FAAA,KAAK,OAAA"}
@@ -0,0 +1,35 @@
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 PullParameters {
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 local branch to fast forward.
21
+ */
22
+ ref: string;
23
+ remote?: string;
24
+ /**
25
+ * The branch or tag on the remote to reference.
26
+ *
27
+ * This defaults to `ref`.
28
+ */
29
+ remoteRef?: string;
30
+ }
31
+ /**
32
+ * Fast forwards the specified `ref` on the local Git repository to match the remote branch.
33
+ */
34
+ export declare const fastForwardBranch: ({ auth, dir, ref, remote, remoteRef, }: PullParameters) => Promise<void>;
35
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fastForwardBranch = void 0;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
9
+ const node_1 = __importDefault(require("isomorphic-git/http/node"));
10
+ const environment_1 = require("../github/environment");
11
+ const remote_1 = require("./remote");
12
+ /**
13
+ * Fast forwards the specified `ref` on the local Git repository to match the remote branch.
14
+ */
15
+ const fastForwardBranch = async ({ auth, dir, ref, remote, remoteRef, }) => {
16
+ const { owner, repo } = await (0, remote_1.getOwnerAndRepo)({ dir });
17
+ const url = `https://github.com/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`;
18
+ return isomorphic_git_1.default.fastForward({
19
+ onAuth: () => ({
20
+ username: 'x-access-token',
21
+ password: auth.token ?? (0, environment_1.apiTokenFromEnvironment)(),
22
+ }),
23
+ dir,
24
+ fs: fs_extra_1.default,
25
+ http: node_1.default,
26
+ ref,
27
+ remote,
28
+ remoteRef,
29
+ url,
30
+ singleBranch: true,
31
+ });
32
+ };
33
+ exports.fastForwardBranch = fastForwardBranch;
34
+ //# sourceMappingURL=pull.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../src/api/git/pull.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,oEAAiC;AACjC,oEAA4C;AAE5C,uDAAgE;AAEhE,qCAA2C;AAsC3C;;GAEG;AACI,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,IAAI,EACJ,GAAG,EACH,GAAG,EACH,MAAM,EACN,SAAS,GACM,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,WAAW,CAAC;QACrB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACb,QAAQ,EAAE,gBAAgB;YAC1B,QAAQ,EAAE,IAAI,CAAC,KAAK,IAAI,IAAA,qCAAuB,GAAE;SAClD,CAAC;QACF,GAAG;QACH,EAAE,EAAF,kBAAE;QACF,IAAI,EAAJ,cAAI;QACJ,GAAG;QACH,MAAM;QACN,SAAS;QACT,GAAG;QACH,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC,CAAC;AA3BW,QAAA,iBAAiB,qBA2B5B"}
@@ -4,3 +4,4 @@ export { createCheckRun } from './checkRun';
4
4
  export { enabledFromEnvironment } from './environment';
5
5
  export { getPullRequestNumber } from './pullRequest';
6
6
  export { putIssueComment } from './issueComment';
7
+ export { readFileChanges, uploadAllFileChanges, uploadFileChanges, } from './push';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.putIssueComment = exports.getPullRequestNumber = exports.enabledFromEnvironment = exports.createCheckRun = exports.buildNameFromEnvironment = void 0;
3
+ exports.uploadFileChanges = exports.uploadAllFileChanges = exports.readFileChanges = exports.putIssueComment = exports.getPullRequestNumber = exports.enabledFromEnvironment = exports.createCheckRun = exports.buildNameFromEnvironment = void 0;
4
4
  var environment_1 = require("./environment");
5
5
  Object.defineProperty(exports, "buildNameFromEnvironment", { enumerable: true, get: function () { return environment_1.buildNameFromEnvironment; } });
6
6
  var checkRun_1 = require("./checkRun");
@@ -11,4 +11,8 @@ var pullRequest_1 = require("./pullRequest");
11
11
  Object.defineProperty(exports, "getPullRequestNumber", { enumerable: true, get: function () { return pullRequest_1.getPullRequestNumber; } });
12
12
  var issueComment_1 = require("./issueComment");
13
13
  Object.defineProperty(exports, "putIssueComment", { enumerable: true, get: function () { return issueComment_1.putIssueComment; } });
14
+ var push_1 = require("./push");
15
+ Object.defineProperty(exports, "readFileChanges", { enumerable: true, get: function () { return push_1.readFileChanges; } });
16
+ Object.defineProperty(exports, "uploadAllFileChanges", { enumerable: true, get: function () { return push_1.uploadAllFileChanges; } });
17
+ Object.defineProperty(exports, "uploadFileChanges", { enumerable: true, get: function () { return push_1.uploadFileChanges; } });
14
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/github/index.ts"],"names":[],"mappings":";;;AACA,6CAAyD;AAAhD,uHAAA,wBAAwB,OAAA;AACjC,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AACvB,6CAAuD;AAA9C,qHAAA,sBAAsB,OAAA;AAC/B,6CAAqD;AAA5C,mHAAA,oBAAoB,OAAA;AAC7B,+CAAiD;AAAxC,+GAAA,eAAe,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/github/index.ts"],"names":[],"mappings":";;;AACA,6CAAyD;AAAhD,uHAAA,wBAAwB,OAAA;AACjC,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AACvB,6CAAuD;AAA9C,qHAAA,sBAAsB,OAAA;AAC/B,6CAAqD;AAA5C,mHAAA,oBAAoB,OAAA;AAC7B,+CAAiD;AAAxC,+GAAA,eAAe,OAAA;AACxB,+BAIgB;AAHd,uGAAA,eAAe,OAAA;AACf,4GAAA,oBAAoB,OAAA;AACpB,yGAAA,iBAAiB,OAAA"}
@@ -0,0 +1,73 @@
1
+ import type { FileAddition, FileDeletion } from '@octokit/graphql-schema';
2
+ import type { ChangedFile } from '../git/getChangedFiles';
3
+ interface UploadAllFileChangesParams {
4
+ dir: string;
5
+ /**
6
+ * The branch name
7
+ */
8
+ branch: string;
9
+ /**
10
+ * The headline of the commit message
11
+ */
12
+ messageHeadline: string;
13
+ /**
14
+ * The body of the commit message
15
+ */
16
+ messageBody?: string;
17
+ /**
18
+ * Updates the local Git repository to match the new remote branch state
19
+ */
20
+ updateLocal?: boolean;
21
+ }
22
+ /**
23
+ * Retrieves all file changes from the local Git repository using
24
+ * `getChangedFiles`, then uploads the changes to a specified GitHub branch
25
+ * using `uploadFileChanges`.
26
+ *
27
+ * Returns the commit ID, or `undefined` if there are no changes to commit.
28
+ *
29
+ * The file changes will appear as verified commits on GitHub.
30
+ *
31
+ * This will not update the local Git repository unless `updateLocal` is
32
+ * specified.
33
+ */
34
+ export declare const uploadAllFileChanges: ({ dir, branch, messageHeadline, messageBody, updateLocal, }: UploadAllFileChangesParams) => Promise<string | undefined>;
35
+ export interface FileChanges {
36
+ additions: FileAddition[];
37
+ deletions: FileDeletion[];
38
+ }
39
+ /**
40
+ * Takes a list of `ChangedFiles`, reads them from the file system, and maps
41
+ * them to GitHub GraphQL `FileChanges`.
42
+ *
43
+ * https://docs.github.com/en/graphql/reference/input-objects#filechanges
44
+ */
45
+ export declare const readFileChanges: (changedFiles: ChangedFile[]) => Promise<FileChanges>;
46
+ interface UploadFileChangesParams {
47
+ dir: string;
48
+ /**
49
+ * The branch name
50
+ */
51
+ branch: string;
52
+ /**
53
+ * The headline of the commit message
54
+ */
55
+ messageHeadline: string;
56
+ /**
57
+ * The body of the commit message
58
+ */
59
+ messageBody?: string;
60
+ /**
61
+ * File additions and deletions
62
+ */
63
+ fileChanges: FileChanges;
64
+ }
65
+ /**
66
+ * Uploads file changes from the local workspace to a specified GitHub branch.
67
+ *
68
+ * The file changes will appear as verified commits on GitHub.
69
+ *
70
+ * This will not update the local Git repository.
71
+ */
72
+ export declare const uploadFileChanges: ({ dir, branch, messageHeadline, messageBody, fileChanges, }: UploadFileChangesParams) => Promise<string>;
73
+ export {};
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.uploadFileChanges = exports.readFileChanges = exports.uploadAllFileChanges = void 0;
30
+ const graphql_1 = require("@octokit/graphql");
31
+ const fs_extra_1 = __importDefault(require("fs-extra"));
32
+ const Git = __importStar(require("../git"));
33
+ const environment_1 = require("./environment");
34
+ /**
35
+ * Retrieves all file changes from the local Git repository using
36
+ * `getChangedFiles`, then uploads the changes to a specified GitHub branch
37
+ * using `uploadFileChanges`.
38
+ *
39
+ * Returns the commit ID, or `undefined` if there are no changes to commit.
40
+ *
41
+ * The file changes will appear as verified commits on GitHub.
42
+ *
43
+ * This will not update the local Git repository unless `updateLocal` is
44
+ * specified.
45
+ */
46
+ const uploadAllFileChanges = async ({ dir, branch, messageHeadline, messageBody, updateLocal = false, }) => {
47
+ const changedFiles = await Git.getChangedFiles({ dir });
48
+ if (!changedFiles.length) {
49
+ return undefined;
50
+ }
51
+ const fileChanges = await (0, exports.readFileChanges)(changedFiles);
52
+ const commitId = await (0, exports.uploadFileChanges)({
53
+ dir,
54
+ branch,
55
+ messageHeadline,
56
+ messageBody,
57
+ fileChanges,
58
+ });
59
+ if (updateLocal) {
60
+ await Promise.all([...fileChanges.additions, ...fileChanges.deletions].map((file) => fs_extra_1.default.rm(file.path)));
61
+ await Git.fastForwardBranch({
62
+ ref: branch,
63
+ auth: { type: 'gitHubApp' },
64
+ dir,
65
+ });
66
+ }
67
+ return commitId;
68
+ };
69
+ exports.uploadAllFileChanges = uploadAllFileChanges;
70
+ /**
71
+ * Takes a list of `ChangedFiles`, reads them from the file system, and maps
72
+ * them to GitHub GraphQL `FileChanges`.
73
+ *
74
+ * https://docs.github.com/en/graphql/reference/input-objects#filechanges
75
+ */
76
+ const readFileChanges = async (changedFiles) => {
77
+ const { added, deleted } = changedFiles.reduce((files, changedFile) => {
78
+ const filePath = changedFile.path;
79
+ if (changedFile.state === 'deleted') {
80
+ files.deleted.push(filePath);
81
+ }
82
+ else {
83
+ files.added.push(filePath);
84
+ }
85
+ return files;
86
+ }, { added: [], deleted: [] });
87
+ const additions = await Promise.all(added.map(async (filePath) => ({
88
+ path: filePath,
89
+ contents: await fs_extra_1.default.promises.readFile(filePath, {
90
+ encoding: 'base64',
91
+ }),
92
+ })));
93
+ const deletions = deleted.map((filePath) => ({
94
+ path: filePath,
95
+ }));
96
+ return {
97
+ additions,
98
+ deletions,
99
+ };
100
+ };
101
+ exports.readFileChanges = readFileChanges;
102
+ /**
103
+ * Uploads file changes from the local workspace to a specified GitHub branch.
104
+ *
105
+ * The file changes will appear as verified commits on GitHub.
106
+ *
107
+ * This will not update the local Git repository.
108
+ */
109
+ const uploadFileChanges = async ({ dir, branch, messageHeadline, messageBody, fileChanges, }) => {
110
+ const authToken = (0, environment_1.apiTokenFromEnvironment)();
111
+ if (!authToken) {
112
+ throw new Error('Could not read a GitHub API token from the environment. Please set GITHUB_API_TOKEN or GITHUB_TOKEN.');
113
+ }
114
+ const [{ owner, repo }, headCommitId] = await Promise.all([
115
+ Git.getOwnerAndRepo({ dir }),
116
+ Git.getHeadCommitId({ dir }),
117
+ ]);
118
+ const input = {
119
+ branch: {
120
+ repositoryNameWithOwner: `${owner}/${repo}`,
121
+ branchName: branch,
122
+ },
123
+ message: {
124
+ headline: messageHeadline,
125
+ body: messageBody,
126
+ },
127
+ expectedHeadOid: headCommitId,
128
+ clientMutationId: 'skuba',
129
+ fileChanges,
130
+ };
131
+ const result = await (0, graphql_1.graphql)(`
132
+ mutation Mutation($input: CreateCommitOnBranchInput!) {
133
+ createCommitOnBranch(input: $input) {
134
+ commit {
135
+ oid
136
+ }
137
+ }
138
+ }
139
+ `, {
140
+ input,
141
+ headers: {
142
+ authorization: `Bearer ${authToken}`,
143
+ },
144
+ });
145
+ return result.createCommitOnBranch.commit.oid;
146
+ };
147
+ exports.uploadFileChanges = uploadFileChanges;
148
+ //# sourceMappingURL=push.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.js","sourceRoot":"","s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,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACxD,GAAG,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;QAC5B,GAAG,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;KAC7B,CAAC,CAAC;IAEH,MAAM,KAAK,GAA8B;QACvC,MAAM,EAAE;YACN,uBAAuB,EAAE,GAAG,KAAK,IAAI,IAAI,EAAE;YAC3C,UAAU,EAAE,MAAM;SACnB;QACD,OAAO,EAAE;YACP,QAAQ,EAAE,eAAe;YACzB,IAAI,EAAE,WAAW;SAClB;QACD,eAAe,EAAE,YAAY;QAC7B,gBAAgB,EAAE,OAAO;QACzB,WAAW;KACZ,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,IAAA,iBAAO,EAC1B;;;;;;;;KAQC,EACD;QACE,KAAK;QACL,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,SAAS,EAAE;SACrC;KACF,CACF,CAAC;IAEF,OAAO,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC;AAChD,CAAC,CAAC;AApDW,QAAA,iBAAiB,qBAoD5B"}
@@ -11,7 +11,7 @@ declare type DefaultOptions = 'collectCoverage' | 'collectCoverageFrom' | 'colle
11
11
  *
12
12
  * This concatenates array options like `testPathIgnorePatterns`.
13
13
  */
14
- export declare const mergePreset: <AdditionalOptions extends "filter" | "json" | "silent" | "cache" | "runner" | "projects" | "id" | "automock" | "cacheDirectory" | "clearMocks" | "coveragePathIgnorePatterns" | "dependencyExtractor" | "detectLeaks" | "detectOpenHandles" | "displayName" | "errorOnDeprecated" | "extensionsToTreatAsEsm" | "fakeTimers" | "forceCoverageMatch" | "globalSetup" | "globalTeardown" | "globals" | "haste" | "injectGlobals" | "moduleDirectories" | "moduleFileExtensions" | "moduleNameMapper" | "modulePathIgnorePatterns" | "modulePaths" | "prettierPath" | "resetMocks" | "resetModules" | "resolver" | "restoreMocks" | "rootDir" | "roots" | "runtime" | "sandboxInjectedGlobals" | "setupFiles" | "setupFilesAfterEnv" | "skipFilter" | "skipNodeResolution" | "slowTestThreshold" | "snapshotResolver" | "snapshotSerializers" | "snapshotFormat" | "testEnvironment" | "testEnvironmentOptions" | "testMatch" | "testLocationInResults" | "testPathIgnorePatterns" | "testRegex" | "testRunner" | "transform" | "transformIgnorePatterns" | "watchPathIgnorePatterns" | "unmockedModulePathPatterns" | "bail" | "ci" | "changedFilesWithAncestor" | "changedSince" | "collectCoverage" | "collectCoverageFrom" | "collectCoverageOnlyFrom" | "coverageDirectory" | "coverageProvider" | "coverageReporters" | "coverageThreshold" | "expand" | "findRelatedTests" | "forceExit" | "reporters" | "logHeapUsage" | "lastCommit" | "listTests" | "maxConcurrency" | "maxWorkers" | "noStackTrace" | "notify" | "notifyMode" | "onlyChanged" | "onlyFailures" | "outputFile" | "passWithNoTests" | "preset" | "replname" | "runTestsByPath" | "testFailureExitCode" | "testNamePattern" | "testResultsProcessor" | "testSequencer" | "testTimeout" | "updateSnapshot" | "useStderr" | "verbose" | "watch" | "watchAll" | "watchman" | "watchPlugins">(options: Pick<Partial<{
14
+ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" | "silent" | "cache" | "runtime" | "runner" | "projects" | "id" | "automock" | "cacheDirectory" | "clearMocks" | "coveragePathIgnorePatterns" | "dependencyExtractor" | "detectLeaks" | "detectOpenHandles" | "displayName" | "errorOnDeprecated" | "extensionsToTreatAsEsm" | "fakeTimers" | "forceCoverageMatch" | "globalSetup" | "globalTeardown" | "globals" | "haste" | "injectGlobals" | "moduleDirectories" | "moduleFileExtensions" | "moduleNameMapper" | "modulePathIgnorePatterns" | "modulePaths" | "prettierPath" | "resetMocks" | "resetModules" | "resolver" | "restoreMocks" | "rootDir" | "roots" | "sandboxInjectedGlobals" | "setupFiles" | "setupFilesAfterEnv" | "skipFilter" | "skipNodeResolution" | "slowTestThreshold" | "snapshotResolver" | "snapshotSerializers" | "snapshotFormat" | "testEnvironment" | "testEnvironmentOptions" | "testMatch" | "testLocationInResults" | "testPathIgnorePatterns" | "testRegex" | "testRunner" | "transform" | "transformIgnorePatterns" | "watchPathIgnorePatterns" | "unmockedModulePathPatterns" | "bail" | "ci" | "changedFilesWithAncestor" | "changedSince" | "collectCoverage" | "collectCoverageFrom" | "collectCoverageOnlyFrom" | "coverageDirectory" | "coverageProvider" | "coverageReporters" | "coverageThreshold" | "expand" | "findRelatedTests" | "forceExit" | "reporters" | "logHeapUsage" | "lastCommit" | "listTests" | "maxConcurrency" | "maxWorkers" | "noStackTrace" | "notify" | "notifyMode" | "onlyChanged" | "onlyFailures" | "outputFile" | "passWithNoTests" | "preset" | "replname" | "runTestsByPath" | "testFailureExitCode" | "testNamePattern" | "testResultsProcessor" | "testSequencer" | "testTimeout" | "updateSnapshot" | "useStderr" | "verbose" | "watch" | "watchAll" | "watchman" | "watchPlugins">(options: Pick<Partial<{
15
15
  automock: boolean;
16
16
  bail: number | boolean;
17
17
  cache: boolean;
@@ -95,25 +95,25 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
95
95
  slowTestThreshold: number;
96
96
  snapshotResolver: string;
97
97
  snapshotSerializers: string[];
98
- snapshotFormat: {
99
- readonly callToJSON?: boolean | undefined;
100
- readonly escapeRegex?: boolean | undefined;
101
- readonly escapeString?: boolean | undefined;
102
- readonly highlight?: boolean | undefined;
103
- readonly indent?: number | undefined;
104
- readonly maxDepth?: number | undefined;
105
- readonly maxWidth?: number | undefined;
106
- readonly min?: boolean | undefined;
107
- readonly printBasicPrototype?: boolean | undefined;
108
- readonly printFunctionName?: boolean | undefined;
109
- readonly theme?: {
110
- readonly value?: string | undefined;
111
- readonly tag?: string | undefined;
112
- readonly content?: string | undefined;
113
- readonly comment?: string | undefined;
114
- readonly prop?: string | undefined;
115
- } | undefined;
116
- };
98
+ snapshotFormat: Partial<{
99
+ readonly callToJSON: boolean;
100
+ readonly escapeRegex: boolean;
101
+ readonly escapeString: boolean;
102
+ readonly highlight: boolean;
103
+ readonly indent: number;
104
+ readonly maxDepth: number;
105
+ readonly maxWidth: number;
106
+ readonly min: boolean;
107
+ readonly printBasicPrototype: boolean;
108
+ readonly printFunctionName: boolean;
109
+ readonly theme: Partial<{
110
+ readonly value: string;
111
+ readonly tag: string;
112
+ readonly content: string;
113
+ readonly comment: string;
114
+ readonly prop: string;
115
+ }>;
116
+ }>;
117
117
  errorOnDeprecated: boolean;
118
118
  testEnvironment: string;
119
119
  testEnvironmentOptions: Record<string, unknown>;
@@ -29,7 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.analyseDependencies = void 0;
30
30
  const path_1 = __importDefault(require("path"));
31
31
  const fs_extra_1 = __importDefault(require("fs-extra"));
32
- const latest_version_1 = __importDefault(require("latest-version"));
33
32
  const copy_1 = require("../../utils/copy");
34
33
  const logging_1 = require("../../utils/logging");
35
34
  const version_1 = require("../../utils/version");
@@ -53,7 +52,7 @@ const pinUnspecifiedVersions = async (dependencies) => {
53
52
  .map(async ([name]) => {
54
53
  const version = await (name === 'skuba'
55
54
  ? (0, version_1.getSkubaVersion)()
56
- : (0, latest_version_1.default)(name));
55
+ : (0, version_1.latestNpmVersion)(name));
57
56
  return [name, version];
58
57
  }));
59
58
  updates.forEach(([name, version]) => {
@@ -1 +1 @@
1
- {"version":3,"file":"analyseDependencies.js","sourceRoot":"","sources":["../../../src/cli/configure/analyseDependencies.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAC1B,oEAA2C;AAI3C,2CAA6C;AAC7C,iDAA0C;AAE1C,iDAAsD;AAEtD,gDAAuE;AACvE,mEAAqD;AACrD,kDAAqD;AAGrD,MAAM,OAAO,GAAG,CAAC,IAAoB,EAAW,EAAE;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAErC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,aAAG,CAAC,EAAE,CAAC,cAAc,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EAAE,KAAK,CAAC,eAAe;QAC1B,GAAG,EAAE,MAAM,CAAC,eAAe;KAC5B,CAAC,CAAC;IAEH,aAAG,CAAC,OAAO,EAAE,CAAC;IACd,aAAG,CAAC,KAAK,CAAC,aAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAEzC,aAAG,CAAC,OAAO,EAAE,CAAC;IACd,MAAM,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAExD,YAAY,EAAE,CAAC;IAEf,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IAEvE,IAAI,CAAC,iBAAiB,IAAI,CAAC,oBAAoB,EAAE;QAC/C,OAAO;KACR;IAED,OAAO,KAAK,IAAI,EAAE;QAChB,MAAM,kBAAkB,GAAG,IAAA,uBAAa,EAAC;YACvC,GAAG,WAAW;YACd,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC,CAAC,CAAC;QAEH,MAAM,kBAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;QAErE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,OAAO;SACR;QAED,MAAM,IAAA,gBAAS,EAAC;YACd,UAAU,EAAE,eAAe;YAC3B,eAAe;YACf,OAAO;YACP,UAAU;SACX,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AApFW,QAAA,mBAAmB,uBAoF9B"}
1
+ {"version":3,"file":"analyseDependencies.js","sourceRoot":"","sources":["../../../src/cli/configure/analyseDependencies.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAI1B,2CAA6C;AAC7C,iDAA0C;AAE1C,iDAAwE;AAExE,gDAAuE;AACvE,mEAAqD;AACrD,kDAAqD;AAGrD,MAAM,OAAO,G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,CAAC,eAAe,CAAC,CAAC,CAAC;IAErC,aAAG,CAAC,OAAO,EAAE,CAAC;IACd,MAAM,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAElD,MAAM,iBAAiB,GAAG,IAAA,0BAAgB,EAAC;QACzC,GAAG,EAAE,KAAK,CAAC,eAAe;QAC1B,GAAG,EAAE,MAAM,CAAC,eAAe;KAC5B,CAAC,CAAC;IAEH,aAAG,CAAC,OAAO,EAAE,CAAC;IACd,aAAG,CAAC,KAAK,CAAC,aAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAEzC,aAAG,CAAC,OAAO,EAAE,CAAC;IACd,MAAM,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAExD,YAAY,EAAE,CAAC;IAEf,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IAEvE,IAAI,CAAC,iBAAiB,IAAI,CAAC,oBAAoB,EAAE;QAC/C,OAAO;KACR;IAED,OAAO,KAAK,IAAI,EAAE;QAChB,MAAM,kBAAkB,GAAG,IAAA,uBAAa,EAAC;YACvC,GAAG,WAAW;YACd,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC,CAAC,CAAC;QAEH,MAAM,kBAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;QAErE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,OAAO;SACR;QAED,MAAM,IAAA,gBAAS,EAAC;YACd,UAAU,EAAE,eAAe;YAC3B,eAAe;YACf,OAAO;YACP,UAAU;SACX,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AApFW,QAAA,mBAAmB,uBAoF9B"}
@@ -1 +1 @@
1
- export declare const determineOperation: (oldData?: string | undefined, newData?: string | undefined) => string;
1
+ export declare const determineOperation: (oldData?: string, newData?: string) => string;
@@ -3,7 +3,7 @@ import type { DependencyDiff, DependencySet } from '../types';
3
3
  interface GetDestinationManifestProps {
4
4
  cwd?: string;
5
5
  }
6
- export declare const getDestinationManifest: (props?: GetDestinationManifestProps | undefined) => Promise<readPkgUp.NormalizedReadResult>;
6
+ export declare const getDestinationManifest: (props?: GetDestinationManifestProps) => Promise<readPkgUp.NormalizedReadResult>;
7
7
  interface DiffDependenciesProps {
8
8
  old: Record<string, string | undefined>;
9
9
  new: Record<string, string | undefined>;
@@ -5,4 +5,4 @@
5
5
  * than `lib/`) but they generally represent the same _intent_.
6
6
  */
7
7
  export declare const generateSimpleVariants: (patterns: string[]) => Set<string>;
8
- export declare const mergeWithIgnoreFile: (rawTemplateFile: string) => (rawInputFile?: string | undefined) => string;
8
+ export declare const mergeWithIgnoreFile: (rawTemplateFile: string) => (rawInputFile?: string) => string;
@@ -1,2 +1,2 @@
1
- export declare const prependImport: (name: string, file?: string | undefined) => string;
1
+ export declare const prependImport: (name: string, file?: string) => string;
2
2
  export declare const stripImports: (names: readonly string[], inputFile: string) => string;
@@ -1,2 +1,2 @@
1
- export declare const formatObject: (data: Record<Exclude<PropertyKey, symbol>, unknown>, filepath?: string | undefined) => string;
1
+ export declare const formatObject: (data: Record<Exclude<PropertyKey, symbol>, unknown>, filepath?: string) => string;
2
2
  export declare const parseObject: (input: string | undefined) => Record<Exclude<PropertyKey, symbol>, unknown> | undefined;
@@ -22,7 +22,7 @@ export declare const createDependencyFilter: (names: readonly string[], type: 'd
22
22
  main?: string | undefined;
23
23
  exports?: import("type-fest").PackageJson.Exports | undefined;
24
24
  imports?: import("type-fest").PackageJson.Imports | undefined;
25
- bin?: string | Record<string, string> | undefined;
25
+ bin?: string | Partial<Record<string, string>> | undefined;
26
26
  man?: string | string[] | undefined;
27
27
  directories?: import("type-fest").PackageJson.DirectoryLocations | undefined;
28
28
  repository?: string | {
@@ -32,21 +32,21 @@ export declare const createDependencyFilter: (names: readonly string[], type: 'd
32
32
  } | undefined;
33
33
  scripts?: import("type-fest").PackageJson.Scripts | undefined;
34
34
  config?: Record<string, unknown> | undefined;
35
- dependencies?: import("type-fest").PackageJson.Dependency | undefined;
36
- devDependencies?: import("type-fest").PackageJson.Dependency | undefined;
37
- optionalDependencies?: import("type-fest").PackageJson.Dependency | undefined;
38
- peerDependencies?: import("type-fest").PackageJson.Dependency | undefined;
39
- peerDependenciesMeta?: Record<string, {
35
+ dependencies?: Partial<Record<string, string>> | undefined;
36
+ devDependencies?: Partial<Record<string, string>> | undefined;
37
+ optionalDependencies?: Partial<Record<string, string>> | undefined;
38
+ peerDependencies?: Partial<Record<string, string>> | undefined;
39
+ peerDependenciesMeta?: Partial<Record<string, {
40
40
  optional: true;
41
- }> | undefined;
41
+ }>> | undefined;
42
42
  bundledDependencies?: string[] | undefined;
43
43
  bundleDependencies?: string[] | undefined;
44
44
  engines?: {
45
- [x: string]: string;
45
+ [x: string]: string | undefined;
46
46
  } | undefined;
47
47
  engineStrict?: boolean | undefined;
48
48
  os?: import("type-fest").LiteralUnion<"aix" | "darwin" | "freebsd" | "linux" | "openbsd" | "sunos" | "win32" | "!aix" | "!darwin" | "!freebsd" | "!linux" | "!openbsd" | "!sunos" | "!win32", string>[] | undefined;
49
- cpu?: import("type-fest").LiteralUnion<"arm" | "arm64" | "ia32" | "mips" | "mipsel" | "ppc" | "ppc64" | "s390" | "s390x" | "x32" | "x64" | "!arm" | "!arm64" | "!ia32" | "!mips" | "!mipsel" | "!ppc" | "!ppc64" | "!s390" | "!s390x" | "!x32" | "!x64", string>[] | undefined;
49
+ cpu?: import("type-fest").LiteralUnion<"arm" | "arm64" | "ia32" | "mips" | "mipsel" | "ppc" | "ppc64" | "s390" | "s390x" | "x64" | "x32" | "!arm" | "!arm64" | "!ia32" | "!mips" | "!mipsel" | "!ppc" | "!ppc64" | "!s390" | "!s390x" | "!x32" | "!x64", string>[] | undefined;
50
50
  preferGlobal?: boolean | undefined;
51
51
  private?: boolean | undefined;
52
52
  publishConfig?: import("type-fest").PackageJson.PublishConfig | undefined;
@@ -60,14 +60,14 @@ export declare const createDependencyFilter: (names: readonly string[], type: 'd
60
60
  main?: string | undefined;
61
61
  browser?: string | undefined;
62
62
  } | undefined;
63
- browser?: string | Record<string, string | false> | undefined;
63
+ browser?: string | Partial<Record<string, string | false>> | undefined;
64
64
  sideEffects?: boolean | string[] | undefined;
65
65
  types?: string | undefined;
66
- typesVersions?: Record<string, Record<string, string[]>> | undefined;
66
+ typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>> | undefined;
67
67
  typings?: string | undefined;
68
68
  workspaces?: string[] | import("type-fest").PackageJson.WorkspaceConfig | undefined;
69
69
  flat?: boolean | undefined;
70
- resolutions?: import("type-fest").PackageJson.Dependency | undefined;
70
+ resolutions?: Partial<Record<string, string>> | undefined;
71
71
  jspm?: import("type-fest").PackageJson | undefined;
72
72
  };
73
73
  export declare const withPackage: (fn: (data: PackageJson) => PackageJson) => (input: string | undefined) => string;
@@ -30,6 +30,7 @@ exports.autofix = void 0;
30
30
  const util_1 = require("util");
31
31
  const simple_git_1 = __importDefault(require("simple-git"));
32
32
  const Git = __importStar(require("../../api/git"));
33
+ const GitHub = __importStar(require("../../api/github"));
33
34
  const eslint_1 = require("../../cli/adapter/eslint");
34
35
  const prettier_1 = require("../../cli/adapter/prettier");
35
36
  const env_1 = require("../../utils/env");
@@ -87,23 +88,33 @@ const autofix = async (params) => {
87
88
  // Unconditionally re-run Prettier; reaching here means we have pre-existing
88
89
  // format violations or may have created new ones through ESLint fixes.
89
90
  await (0, prettier_1.runPrettier)('format', logger);
90
- const ref = await Git.commitAllChanges({
91
+ if (process.env.GITHUB_ACTIONS) {
92
+ // GitHub runners have Git installed locally
93
+ const ref = await Git.commitAllChanges({
94
+ dir,
95
+ message: AUTOFIX_COMMIT_MESSAGE,
96
+ });
97
+ if (!ref) {
98
+ return logging_1.log.warn('No autofixes detected.');
99
+ }
100
+ await (0, wait_1.throwOnTimeout)((0, simple_git_1.default)().push(), { s: 30 });
101
+ logging_1.log.warn(`Pushed fix commit ${ref}.`);
102
+ return;
103
+ }
104
+ // Other CI Environments, use GitHub API
105
+ if (!currentBranch) {
106
+ logging_1.log.warn('Could not determine the current branch.');
107
+ logging_1.log.warn('Please propagate BUILDKITE_BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME, or the .git directory to your container.');
108
+ return;
109
+ }
110
+ const ref = await (0, wait_1.throwOnTimeout)(GitHub.uploadAllFileChanges({
91
111
  dir,
92
- message: AUTOFIX_COMMIT_MESSAGE,
93
- });
112
+ branch: currentBranch,
113
+ messageHeadline: AUTOFIX_COMMIT_MESSAGE,
114
+ }), { s: 30 });
94
115
  if (!ref) {
95
116
  return logging_1.log.warn('No autofixes detected.');
96
117
  }
97
- await (0, wait_1.throwOnTimeout)(process.env.GITHUB_ACTIONS
98
- ? // GitHub's checkout action should preconfigure the Git CLI.
99
- (0, simple_git_1.default)().push()
100
- : // In other CI environments (Buildkite) we fall back to GitHub App auth.
101
- Git.push({
102
- auth: { type: 'gitHubApp' },
103
- dir: process.cwd(),
104
- ref,
105
- remoteRef: currentBranch,
106
- }), { s: 30 });
107
118
  logging_1.log.warn(`Pushed fix commit ${ref}.`);
108
119
  }
109
120
  catch (err) {