backport 6.1.3 → 6.2.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.
- package/README.md +40 -37
- package/dist/backportRun.d.ts +14 -0
- package/dist/backportRun.js +75 -0
- package/dist/entrypoint.api.d.ts +22 -0
- package/dist/entrypoint.api.js +57 -0
- package/dist/entrypoint.api.private.test.d.ts +1 -0
- package/dist/entrypoint.api.private.test.js +37 -0
- package/dist/entrypoint.cli.js +3 -5
- package/dist/entrypoint.module.d.ts +6 -3
- package/dist/entrypoint.module.js +13 -7
- package/dist/entrypoint.module.private.test.js +4 -1
- package/dist/main.js +5 -1
- package/dist/options/ConfigOptions.d.ts +4 -0
- package/dist/options/cliArgs.d.ts +17 -11
- package/dist/options/cliArgs.js +36 -5
- package/dist/options/config/config.d.ts +10 -1
- package/dist/options/config/config.js +9 -3
- package/dist/options/config/config.test.js +27 -1
- package/dist/options/config/getProjectConfig.d.ts +0 -0
- package/dist/options/config/getProjectConfig.js +1 -0
- package/dist/options/config/globalConfig.d.ts +2 -2
- package/dist/options/config/globalConfig.js +16 -14
- package/dist/options/config/globalConfig.test.js +10 -4
- package/dist/options/config/projectConfig.d.ts +3 -1
- package/dist/options/config/projectConfig.js +5 -2
- package/dist/options/config/projectConfig.test.js +35 -6
- package/dist/options/config/readConfigFile.d.ts +26 -22
- package/dist/options/options.d.ts +18 -9
- package/dist/options/options.js +11 -4
- package/dist/options/options.test.js +40 -35
- package/dist/react-components/0-loadOptions.d.ts +6 -0
- package/dist/react-components/0-loadOptions.js +45 -0
- package/dist/react-components/1-loadCommit.d.ts +8 -0
- package/dist/react-components/1-loadCommit.js +88 -0
- package/dist/react-components/1a-loadCommit.d.ts +5 -0
- package/dist/react-components/1a-loadCommit.js +76 -0
- package/dist/react-components/1b-commitChoices.d.ts +5 -0
- package/dist/react-components/1b-commitChoices.js +98 -0
- package/dist/react-components/2-commitChoices.d.ts +8 -0
- package/dist/react-components/2-commitChoices.js +96 -0
- package/dist/react-components/2-commitsPrompt.d.ts +8 -0
- package/dist/react-components/2-commitsPrompt.js +96 -0
- package/dist/react-components/2-targetBranchChoices.d.ts +9 -0
- package/dist/react-components/2-targetBranchChoices.js +109 -0
- package/dist/react-components/3-cherrypick.d.ts +1 -0
- package/dist/react-components/3-cherrypick.js +2 -0
- package/dist/react-components/App.d.ts +2 -0
- package/dist/react-components/App.js +35 -0
- package/dist/react-components/BackportStateContext.d.ts +33 -0
- package/dist/react-components/BackportStateContext.js +42 -0
- package/dist/react-components/CommitPrompt/2-commitsPrompt.d.ts +8 -0
- package/dist/react-components/CommitPrompt/2-commitsPrompt.js +96 -0
- package/dist/react-components/CommitPrompt/CommitPrompt.d.ts +8 -0
- package/dist/react-components/CommitPrompt/CommitPrompt.js +96 -0
- package/dist/react-components/CommitPrompt/getCommits.d.ts +2 -0
- package/dist/react-components/CommitPrompt/getCommits.js +27 -0
- package/dist/react-components/CommitPrompt.d.ts +8 -0
- package/dist/react-components/CommitPrompt.js +96 -0
- package/dist/react-components/CustomMultiSelect.d.ts +13 -0
- package/dist/react-components/CustomMultiSelect.js +21 -0
- package/dist/react-components/CustomMultiSelectItem.d.ts +5 -0
- package/dist/react-components/CustomMultiSelectItem.js +12 -0
- package/dist/react-components/CustomSelect.d.ts +14 -0
- package/dist/react-components/CustomSelect.js +34 -0
- package/dist/react-components/ErrorBoundary.d.ts +15 -0
- package/dist/react-components/ErrorBoundary.js +53 -0
- package/dist/react-components/MultiSelect.d.ts +7 -0
- package/dist/react-components/MultiSelect.js +16 -0
- package/dist/react-components/hooks/useAsync.d.ts +12 -0
- package/dist/react-components/hooks/useAsync.js +73 -0
- package/dist/runSequentially.test.js +11 -13
- package/dist/scripts/postinstall.js +3 -3
- package/dist/services/HandledError.d.ts +1 -1
- package/dist/services/backportRun/backportRun.ci.d.ts +6 -0
- package/dist/services/backportRun/backportRun.ci.js +81 -0
- package/dist/services/backportRun/backportRun.d.ts +14 -0
- package/dist/services/backportRun/backportRun.interactive.d.ts +1 -0
- package/dist/services/backportRun/backportRun.interactive.js +4 -0
- package/dist/services/backportRun/backportRun.js +14 -0
- package/dist/services/backportRun/backportState.d.ts +4 -0
- package/dist/services/backportRun/backportState.js +28 -0
- package/dist/services/backportRun/getCommits.d.ts +2 -0
- package/dist/services/backportRun/getCommits.js +20 -0
- package/dist/services/backportRun/runSequentially.d.ts +20 -0
- package/dist/services/backportRun/runSequentially.js +41 -0
- package/dist/services/backportRun/runSequentially.test.d.ts +1 -0
- package/dist/services/backportRun/runSequentially.test.js +199 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.d.ts +12 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.js +206 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.js +403 -0
- package/dist/services/env.d.ts +5 -4
- package/dist/services/env.js +13 -11
- package/dist/services/env.test.js +0 -6
- package/dist/services/getCommits.d.ts +2 -0
- package/dist/services/getCommits.js +38 -0
- package/dist/services/getCommitsWithoutBackports.d.ts +11 -0
- package/dist/services/getCommitsWithoutBackports.js +68 -0
- package/dist/services/getCommitsWithoutBackports.test.d.ts +1 -0
- package/dist/services/getCommitsWithoutBackports.test.js +259 -0
- package/dist/services/getTargetBranches.d.ts +5 -0
- package/dist/services/getTargetBranches.js +60 -0
- package/dist/services/getTargetBranches.test.d.ts +1 -0
- package/dist/services/getTargetBranches.test.js +180 -0
- package/dist/services/git.d.ts +2 -1
- package/dist/services/git.js +5 -3
- package/dist/services/github/v3/createPullRequest.js +8 -5
- package/dist/services/github/v3/createPullRequest.test.js +60 -10
- package/dist/services/github/v3/createStatusComment.d.ts +2 -2
- package/dist/services/github/v3/createStatusComment.js +40 -15
- package/dist/services/github/v3/createStatusComment.test.js +174 -86
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +78 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +1 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +64 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +5 -5
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +60 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +2 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +17 -10
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +72 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +6 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +8 -7
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +8 -0
- package/dist/services/github/v4/fetchProjectConfig.d.ts +1 -1
- package/dist/services/github/v4/fetchProjectConfig.js +3 -3
- package/dist/services/github/v4/fetchProjectConfig.private.test.js +5 -5
- package/dist/services/github/v4/fetchRemoteProjectConfig.d.ts +8 -0
- package/dist/services/github/v4/fetchRemoteProjectConfig.js +56 -0
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +52 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +4 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +0 -7
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +16 -5
- package/dist/services/logger.d.ts +4 -2
- package/dist/services/logger.js +31 -32
- package/dist/services/maybeSetupRepo.d.ts +2 -0
- package/dist/services/maybeSetupRepo.js +33 -0
- package/dist/services/maybeSetupRepo.test.d.ts +1 -0
- package/dist/services/maybeSetupRepo.test.js +78 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +4 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +8 -2
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +20 -0
- package/dist/services/sourceCommit/getMockSourceCommit.d.ts +1 -0
- package/dist/services/sourceCommit/getMockSourceCommit.js +72 -46
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +22 -8
- package/dist/services/sourceCommit/parseSourceCommit.js +29 -10
- package/dist/services/sourceCommit/parseSourceCommit.test.js +10 -2
- package/dist/test/backport-e2e.private.test.d.ts +1 -0
- package/dist/test/backport-e2e.private.test.js +325 -0
- package/dist/test/handleUnbackportedPullRequests.private.test.d.ts +1 -0
- package/dist/test/handleUnbackportedPullRequests.private.test.js +43 -0
- package/dist/test/inquirer.private.test.js +3 -1
- package/dist/test/integration/integration.private.test.js +2 -2
- package/dist/test/nockHelpers.js +1 -3
- package/dist/test/setupFiles/automatic-mocks.js +1 -0
- package/dist/todo-delete.d.ts +1 -0
- package/dist/todo-delete.js +17 -0
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +4 -3
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +9 -12
- package/dist/ui/getCommits.js +1 -1
- package/dist/ui/getCommitsWithoutBackports.js +17 -2
- package/dist/ui/maybeSetupRepo.js +0 -6
- package/dist/ui/maybeSetupRepo.test.js +8 -4
- package/dist/utils/redact.d.ts +1 -0
- package/dist/utils/redact.js +7 -0
- package/dist/utils/sequentially.d.ts +1 -0
- package/dist/utils/sequentially.js +10 -0
- package/package.json +11 -11
- package/yarn.lock +570 -436
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken");
|
|
4
|
+
const fetchCommitByPullNumber_1 = require("./fetchCommitByPullNumber");
|
|
5
|
+
const fetchCommitBySha_1 = require("./fetchCommitBySha");
|
|
6
|
+
const fetchCommitsByAuthor_1 = require("./fetchCommitsByAuthor");
|
|
7
|
+
const fetchPullRequestBySearchQuery_1 = require("./fetchPullRequestBySearchQuery");
|
|
8
|
+
describe('allFetchers', () => {
|
|
9
|
+
let devAccessToken;
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
12
|
+
});
|
|
13
|
+
it('all fetchers return the same commit', async () => {
|
|
14
|
+
const commitsByAuthor = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
15
|
+
accessToken: devAccessToken,
|
|
16
|
+
author: 'sqren',
|
|
17
|
+
historicalBranchLabelMappings: [],
|
|
18
|
+
maxNumber: 1,
|
|
19
|
+
repoName: 'kibana',
|
|
20
|
+
repoOwner: 'elastic',
|
|
21
|
+
sourceBranch: 'main',
|
|
22
|
+
dateSince: '2021-01-10T00:00:00Z',
|
|
23
|
+
dateUntil: '2022-01-01T00:00:00Z',
|
|
24
|
+
commitPaths: [],
|
|
25
|
+
});
|
|
26
|
+
const commitByAuthor = commitsByAuthor[0];
|
|
27
|
+
if (!commitByAuthor.pullNumber) {
|
|
28
|
+
throw new Error('Missing pullnumber!');
|
|
29
|
+
}
|
|
30
|
+
const commitByPullNumber = await (0, fetchCommitByPullNumber_1.fetchCommitByPullNumber)({
|
|
31
|
+
repoOwner: 'elastic',
|
|
32
|
+
repoName: 'kibana',
|
|
33
|
+
accessToken: devAccessToken,
|
|
34
|
+
pullNumber: commitByAuthor.pullNumber,
|
|
35
|
+
sourceBranch: 'master',
|
|
36
|
+
historicalBranchLabelMappings: [],
|
|
37
|
+
});
|
|
38
|
+
const commitBySha = await (0, fetchCommitBySha_1.fetchCommitBySha)({
|
|
39
|
+
repoOwner: 'elastic',
|
|
40
|
+
repoName: 'kibana',
|
|
41
|
+
accessToken: devAccessToken,
|
|
42
|
+
sha: commitByAuthor.sha,
|
|
43
|
+
sourceBranch: 'main',
|
|
44
|
+
historicalBranchLabelMappings: [],
|
|
45
|
+
});
|
|
46
|
+
const commitsBySearchQuery = await (0, fetchPullRequestBySearchQuery_1.fetchPullRequestBySearchQuery)({
|
|
47
|
+
repoOwner: 'elastic',
|
|
48
|
+
repoName: 'kibana',
|
|
49
|
+
accessToken: devAccessToken,
|
|
50
|
+
maxNumber: 1,
|
|
51
|
+
prFilter: `[APM] Add note about synthtrace to APM docs`,
|
|
52
|
+
sourceBranch: 'main',
|
|
53
|
+
});
|
|
54
|
+
expect(commitByAuthor).toEqual(commitByPullNumber);
|
|
55
|
+
expect(commitByAuthor).toEqual(commitBySha);
|
|
56
|
+
expect(commitByAuthor).toEqual(commitsBySearchQuery[0]);
|
|
57
|
+
expect(commitByAuthor).toEqual({
|
|
58
|
+
committedDate: '2021-12-20T14:20:16Z',
|
|
59
|
+
expectedTargetPullRequests: [
|
|
60
|
+
{
|
|
61
|
+
branch: '8.0',
|
|
62
|
+
mergeCommit: {
|
|
63
|
+
message: '[APM] Add note about synthtrace to APM docs (#121633) (#121643)\n\nCo-authored-by: Søren Louv-Jansen <soren.louv@elastic.co>',
|
|
64
|
+
sha: '842adfdeb5541b059231857522f9009771a46107',
|
|
65
|
+
},
|
|
66
|
+
number: 121643,
|
|
67
|
+
state: 'MERGED',
|
|
68
|
+
url: 'https://github.com/elastic/kibana/pull/121643',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
originalMessage: '[APM] Add note about synthtrace to APM docs (#121633)',
|
|
72
|
+
pullNumber: 121633,
|
|
73
|
+
pullUrl: 'https://github.com/elastic/kibana/pull/121633',
|
|
74
|
+
sha: 'd421ddcf6157150596581c7885afa3690cec6339',
|
|
75
|
+
sourceBranch: 'main',
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -15,7 +15,7 @@ async function fetchCommitByPullNumber(options) {
|
|
|
15
15
|
repository(owner: $repoOwner, name: $repoName) {
|
|
16
16
|
pullRequest(number: $pullNumber) {
|
|
17
17
|
mergeCommit {
|
|
18
|
-
|
|
18
|
+
...SourceCommitWithTargetPullRequest
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,12 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
2
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
3
26
|
const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken");
|
|
27
|
+
const apiRequestV4Module = __importStar(require("../apiRequestV4"));
|
|
4
28
|
const fetchCommitByPullNumber_1 = require("./fetchCommitByPullNumber");
|
|
5
29
|
describe('fetchCommitByPullNumber', () => {
|
|
6
30
|
let devAccessToken;
|
|
7
31
|
beforeAll(async () => {
|
|
8
32
|
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
33
|
});
|
|
34
|
+
describe('snapshot request/response', () => {
|
|
35
|
+
let spy;
|
|
36
|
+
let commit;
|
|
37
|
+
beforeEach(async () => {
|
|
38
|
+
spy = jest.spyOn(apiRequestV4Module, 'apiRequestV4');
|
|
39
|
+
commit = await (0, fetchCommitByPullNumber_1.fetchCommitByPullNumber)({
|
|
40
|
+
repoOwner: 'elastic',
|
|
41
|
+
repoName: 'kibana',
|
|
42
|
+
accessToken: devAccessToken,
|
|
43
|
+
pullNumber: 121633,
|
|
44
|
+
sourceBranch: 'master',
|
|
45
|
+
historicalBranchLabelMappings: [],
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
it('makes the right queries', () => {
|
|
49
|
+
const queries = spy.mock.calls.reduce((acc, call) => {
|
|
50
|
+
const query = call[0].query;
|
|
51
|
+
const ast = (0, graphql_tag_1.default)(query);
|
|
52
|
+
//@ts-expect-error
|
|
53
|
+
const name = ast.definitions[0].name.value;
|
|
54
|
+
return { ...acc, [name]: query };
|
|
55
|
+
}, {});
|
|
56
|
+
const queryNames = Object.keys(queries);
|
|
57
|
+
expect(queryNames).toEqual(['CommitByPullNumber']);
|
|
58
|
+
queryNames.forEach((name) => {
|
|
59
|
+
expect(queries[name]).toMatchSnapshot(`Query: ${name}`);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
it('returns the correct response', async () => {
|
|
63
|
+
expect(commit).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
10
66
|
describe('when PR was merged', () => {
|
|
11
67
|
it('is returned', async () => {
|
|
12
68
|
const options = {
|
|
@@ -30,12 +86,20 @@ describe('fetchCommitByPullNumber', () => {
|
|
|
30
86
|
state: 'MERGED',
|
|
31
87
|
number: 6,
|
|
32
88
|
url: 'https://github.com/backport-org/backport-e2e/pull/6',
|
|
89
|
+
mergeCommit: {
|
|
90
|
+
message: 'Add 🍏 emoji (#5) (#6)',
|
|
91
|
+
sha: '4bcd876d4ceaa73cf437bfc89b74d1a4e704c0a6',
|
|
92
|
+
},
|
|
33
93
|
},
|
|
34
94
|
{
|
|
35
95
|
branch: '7.8',
|
|
36
96
|
state: 'MERGED',
|
|
37
97
|
number: 7,
|
|
38
98
|
url: 'https://github.com/backport-org/backport-e2e/pull/7',
|
|
99
|
+
mergeCommit: {
|
|
100
|
+
message: 'Add 🍏 emoji (#5) (#7)',
|
|
101
|
+
sha: '46cd6f9999effdf894a36dbc7db90e890f4be840',
|
|
102
|
+
},
|
|
39
103
|
},
|
|
40
104
|
],
|
|
41
105
|
});
|
|
@@ -7,13 +7,13 @@ const apiRequestV4_1 = require("../apiRequestV4");
|
|
|
7
7
|
async function fetchCommitBySha(options) {
|
|
8
8
|
const { accessToken, githubApiBaseUrlV4 = 'https://api.github.com/graphql', repoName, repoOwner, sha, sourceBranch, } = options;
|
|
9
9
|
const query = /* GraphQL */ `
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
query CommitsBySha($repoOwner: String!, $repoName: String!, $oid: String!) {
|
|
11
|
+
repository(owner: $repoOwner, name: $repoName) {
|
|
12
|
+
object(expression: $oid) {
|
|
13
|
+
...SourceCommitWithTargetPullRequest
|
|
14
|
+
}
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
|
-
}
|
|
17
17
|
|
|
18
18
|
${parseSourceCommit_1.sourceCommitWithTargetPullRequestFragment.source}
|
|
19
19
|
`;
|
|
@@ -1,12 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
2
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
3
26
|
const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken");
|
|
27
|
+
const apiRequestV4Module = __importStar(require("../apiRequestV4"));
|
|
4
28
|
const fetchCommitBySha_1 = require("./fetchCommitBySha");
|
|
5
29
|
describe('fetchCommitBySha', () => {
|
|
6
30
|
let devAccessToken;
|
|
7
31
|
beforeEach(async () => {
|
|
8
32
|
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
33
|
});
|
|
34
|
+
describe('snapshot request/response', () => {
|
|
35
|
+
let spy;
|
|
36
|
+
let commit;
|
|
37
|
+
beforeEach(async () => {
|
|
38
|
+
spy = jest.spyOn(apiRequestV4Module, 'apiRequestV4');
|
|
39
|
+
commit = await (0, fetchCommitBySha_1.fetchCommitBySha)({
|
|
40
|
+
repoOwner: 'elastic',
|
|
41
|
+
repoName: 'kibana',
|
|
42
|
+
accessToken: devAccessToken,
|
|
43
|
+
sha: 'd421ddcf6157150596581c7885afa3690cec6339',
|
|
44
|
+
sourceBranch: 'main',
|
|
45
|
+
historicalBranchLabelMappings: [],
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
it('makes the right queries', () => {
|
|
49
|
+
const queries = spy.mock.calls.reduce((acc, call) => {
|
|
50
|
+
const query = call[0].query;
|
|
51
|
+
const ast = (0, graphql_tag_1.default)(query);
|
|
52
|
+
//@ts-expect-error
|
|
53
|
+
const name = ast.definitions[0].name.value;
|
|
54
|
+
return { ...acc, [name]: query };
|
|
55
|
+
}, {});
|
|
56
|
+
const queryNames = Object.keys(queries);
|
|
57
|
+
expect(queryNames).toEqual(['CommitsBySha']);
|
|
58
|
+
queryNames.forEach((name) => {
|
|
59
|
+
expect(queries[name]).toMatchSnapshot(`Query: ${name}`);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
it('returns the correct response', async () => {
|
|
63
|
+
expect(commit).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
10
66
|
it('should return single commit with pull request', async () => {
|
|
11
67
|
await expect(await (0, fetchCommitBySha_1.fetchCommitBySha)({
|
|
12
68
|
repoOwner: 'elastic',
|
|
@@ -28,6 +84,10 @@ describe('fetchCommitBySha', () => {
|
|
|
28
84
|
state: 'MERGED',
|
|
29
85
|
number: 71014,
|
|
30
86
|
url: 'https://github.com/elastic/kibana/pull/71014',
|
|
87
|
+
mergeCommit: {
|
|
88
|
+
message: '[APM] Add API tests (#70740) (#71014)',
|
|
89
|
+
sha: 'd15242be682582e58cd69f6b7707565434e99293',
|
|
90
|
+
},
|
|
31
91
|
},
|
|
32
92
|
],
|
|
33
93
|
});
|
|
@@ -11,6 +11,8 @@ export declare function fetchCommitsByAuthor(options: {
|
|
|
11
11
|
repoName: string;
|
|
12
12
|
repoOwner: string;
|
|
13
13
|
sourceBranch: string;
|
|
14
|
+
dateSince: string | null;
|
|
15
|
+
dateUntil: string | null;
|
|
14
16
|
}): Promise<Commit[]>;
|
|
15
17
|
export interface CommitByAuthorResponse {
|
|
16
18
|
repository: {
|
|
@@ -8,7 +8,7 @@ const parseSourceCommit_1 = require("../../../sourceCommit/parseSourceCommit");
|
|
|
8
8
|
const apiRequestV4_1 = require("../apiRequestV4");
|
|
9
9
|
const fetchAuthorId_1 = require("../fetchAuthorId");
|
|
10
10
|
function fetchByCommitPath({ options, authorId, commitPath, }) {
|
|
11
|
-
const { accessToken, githubApiBaseUrlV4 = 'https://api.github.com/graphql', maxNumber = 10, repoName, repoOwner, sourceBranch, } = options;
|
|
11
|
+
const { accessToken, githubApiBaseUrlV4 = 'https://api.github.com/graphql', maxNumber = 10, repoName, repoOwner, sourceBranch, dateSince, dateUntil, } = options;
|
|
12
12
|
const query = /* GraphQL */ `
|
|
13
13
|
query CommitsByAuthor(
|
|
14
14
|
$repoOwner: String!
|
|
@@ -17,6 +17,8 @@ function fetchByCommitPath({ options, authorId, commitPath, }) {
|
|
|
17
17
|
$sourceBranch: String!
|
|
18
18
|
$authorId: ID
|
|
19
19
|
$commitPath: String
|
|
20
|
+
$dateSince: GitTimestamp
|
|
21
|
+
$dateUntil: GitTimestamp
|
|
20
22
|
) {
|
|
21
23
|
repository(owner: $repoOwner, name: $repoName) {
|
|
22
24
|
ref(qualifiedName: $sourceBranch) {
|
|
@@ -26,10 +28,12 @@ function fetchByCommitPath({ options, authorId, commitPath, }) {
|
|
|
26
28
|
first: $maxNumber
|
|
27
29
|
author: { id: $authorId }
|
|
28
30
|
path: $commitPath
|
|
31
|
+
since: $dateSince
|
|
32
|
+
until: $dateUntil
|
|
29
33
|
) {
|
|
30
34
|
edges {
|
|
31
35
|
node {
|
|
32
|
-
|
|
36
|
+
...SourceCommitWithTargetPullRequest
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
}
|
|
@@ -41,18 +45,21 @@ function fetchByCommitPath({ options, authorId, commitPath, }) {
|
|
|
41
45
|
|
|
42
46
|
${parseSourceCommit_1.sourceCommitWithTargetPullRequestFragment.source}
|
|
43
47
|
`;
|
|
48
|
+
const variables = {
|
|
49
|
+
repoOwner,
|
|
50
|
+
repoName,
|
|
51
|
+
sourceBranch,
|
|
52
|
+
maxNumber,
|
|
53
|
+
authorId,
|
|
54
|
+
commitPath,
|
|
55
|
+
dateSince,
|
|
56
|
+
dateUntil,
|
|
57
|
+
};
|
|
44
58
|
return (0, apiRequestV4_1.apiRequestV4)({
|
|
45
59
|
githubApiBaseUrlV4,
|
|
46
60
|
accessToken,
|
|
47
61
|
query,
|
|
48
|
-
variables
|
|
49
|
-
repoOwner,
|
|
50
|
-
repoName,
|
|
51
|
-
sourceBranch,
|
|
52
|
-
maxNumber,
|
|
53
|
-
authorId,
|
|
54
|
-
commitPath,
|
|
55
|
-
},
|
|
62
|
+
variables,
|
|
56
63
|
});
|
|
57
64
|
}
|
|
58
65
|
async function fetchCommitsByAuthor(options) {
|
|
@@ -1,12 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
2
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
3
26
|
const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken");
|
|
27
|
+
const apiRequestV4Module = __importStar(require("../apiRequestV4"));
|
|
4
28
|
const fetchCommitsByAuthor_1 = require("./fetchCommitsByAuthor");
|
|
5
29
|
describe('fetchCommitsByAuthor', () => {
|
|
6
30
|
let devAccessToken;
|
|
7
31
|
beforeAll(async () => {
|
|
8
32
|
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
33
|
});
|
|
34
|
+
describe('snapshot request/response', () => {
|
|
35
|
+
let spy;
|
|
36
|
+
let commits;
|
|
37
|
+
beforeEach(async () => {
|
|
38
|
+
spy = jest.spyOn(apiRequestV4Module, 'apiRequestV4');
|
|
39
|
+
commits = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
40
|
+
accessToken: devAccessToken,
|
|
41
|
+
author: 'sqren',
|
|
42
|
+
historicalBranchLabelMappings: [],
|
|
43
|
+
maxNumber: 10,
|
|
44
|
+
repoName: 'kibana',
|
|
45
|
+
repoOwner: 'elastic',
|
|
46
|
+
sourceBranch: 'main',
|
|
47
|
+
dateSince: '2021-01-10T00:00:00Z',
|
|
48
|
+
dateUntil: '2022-01-01T00:00:00Z',
|
|
49
|
+
commitPaths: [],
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
it('makes the right queries', () => {
|
|
53
|
+
const queries = spy.mock.calls.reduce((acc, call) => {
|
|
54
|
+
const query = call[0].query;
|
|
55
|
+
const ast = (0, graphql_tag_1.default)(query);
|
|
56
|
+
//@ts-expect-error
|
|
57
|
+
const name = ast.definitions[0].name.value;
|
|
58
|
+
return { ...acc, [name]: query };
|
|
59
|
+
}, {});
|
|
60
|
+
const queryNames = Object.keys(queries);
|
|
61
|
+
expect(queryNames).toEqual(['AuthorId', 'CommitsByAuthor']);
|
|
62
|
+
queryNames.forEach((name) => {
|
|
63
|
+
expect(queries[name]).toMatchSnapshot(`Query: ${name}`);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
it('returns the correct response', async () => {
|
|
67
|
+
expect(commits).toMatchSnapshot();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
10
70
|
describe('commitPaths', () => {
|
|
11
71
|
const getOptions = () => ({
|
|
12
72
|
accessToken: devAccessToken,
|
|
@@ -16,6 +76,8 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
16
76
|
repoName: 'repo-with-different-commit-paths',
|
|
17
77
|
repoOwner: 'backport-org',
|
|
18
78
|
sourceBranch: 'main',
|
|
79
|
+
dateSince: null,
|
|
80
|
+
dateUntil: null,
|
|
19
81
|
});
|
|
20
82
|
const getCommitMessages = (commits) => {
|
|
21
83
|
return commits.map((c) => c.originalMessage.replace(/(\r\n|\n|\r)/gm, ''));
|
|
@@ -90,6 +152,8 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
90
152
|
repoOwner: 'backport-org',
|
|
91
153
|
sourceBranch: 'master',
|
|
92
154
|
author: null,
|
|
155
|
+
dateSince: null,
|
|
156
|
+
dateUntil: null,
|
|
93
157
|
});
|
|
94
158
|
});
|
|
95
159
|
it('returns related OPEN PRs', async () => {
|
|
@@ -111,12 +175,20 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
111
175
|
state: 'MERGED',
|
|
112
176
|
number: 6,
|
|
113
177
|
url: 'https://github.com/backport-org/backport-e2e/pull/6',
|
|
178
|
+
mergeCommit: {
|
|
179
|
+
message: 'Add 🍏 emoji (#5) (#6)',
|
|
180
|
+
sha: '4bcd876d4ceaa73cf437bfc89b74d1a4e704c0a6',
|
|
181
|
+
},
|
|
114
182
|
},
|
|
115
183
|
{
|
|
116
184
|
branch: '7.8',
|
|
117
185
|
state: 'MERGED',
|
|
118
186
|
number: 7,
|
|
119
187
|
url: 'https://github.com/backport-org/backport-e2e/pull/7',
|
|
188
|
+
mergeCommit: {
|
|
189
|
+
message: 'Add 🍏 emoji (#5) (#7)',
|
|
190
|
+
sha: '46cd6f9999effdf894a36dbc7db90e890f4be840',
|
|
191
|
+
},
|
|
120
192
|
},
|
|
121
193
|
]);
|
|
122
194
|
});
|
|
@@ -16,6 +16,8 @@ const defaultOptions = {
|
|
|
16
16
|
repoName: 'kibana',
|
|
17
17
|
repoOwner: 'elastic',
|
|
18
18
|
sourceBranch: 'source-branch-from-options',
|
|
19
|
+
dateSince: null,
|
|
20
|
+
dateUntil: null,
|
|
19
21
|
};
|
|
20
22
|
const authorIdMockData = { user: { id: 'myUserId' } };
|
|
21
23
|
describe('fetchCommitsByAuthor', () => {
|
|
@@ -72,6 +74,10 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
72
74
|
state: 'MERGED',
|
|
73
75
|
number: 99,
|
|
74
76
|
url: 'https://github.com/elastic/kibana/pull/99',
|
|
77
|
+
mergeCommit: {
|
|
78
|
+
message: 'Add SF mention (#80)\n\n* Add SF mention\r\n\r\n* Add several emojis!',
|
|
79
|
+
sha: 'target-merge-commit-sha',
|
|
80
|
+
},
|
|
75
81
|
},
|
|
76
82
|
],
|
|
77
83
|
sourceBranch: 'master',
|
|
@@ -13,7 +13,7 @@ async function fetchPullRequestBySearchQuery(options) {
|
|
|
13
13
|
nodes {
|
|
14
14
|
... on PullRequest {
|
|
15
15
|
mergeCommit {
|
|
16
|
-
|
|
16
|
+
...SourceCommitWithTargetPullRequest
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -22,16 +22,17 @@ async function fetchPullRequestBySearchQuery(options) {
|
|
|
22
22
|
|
|
23
23
|
${parseSourceCommit_1.sourceCommitWithTargetPullRequestFragment.source}
|
|
24
24
|
`;
|
|
25
|
-
const authorFilter = author ? `author:${author}` : '';
|
|
26
|
-
const searchQuery = `type:pr is:merged sort:updated-desc repo:${repoOwner}/${repoName}
|
|
25
|
+
const authorFilter = author ? ` author:${author}` : '';
|
|
26
|
+
const searchQuery = `type:pr is:merged sort:updated-desc repo:${repoOwner}/${repoName}${authorFilter} ${prFilter} base:${sourceBranch}`;
|
|
27
|
+
const variables = {
|
|
28
|
+
query: searchQuery,
|
|
29
|
+
maxNumber: maxNumber,
|
|
30
|
+
};
|
|
27
31
|
const res = await (0, apiRequestV4_1.apiRequestV4)({
|
|
28
32
|
githubApiBaseUrlV4,
|
|
29
33
|
accessToken,
|
|
30
34
|
query,
|
|
31
|
-
variables
|
|
32
|
-
query: searchQuery,
|
|
33
|
-
maxNumber: maxNumber,
|
|
34
|
-
},
|
|
35
|
+
variables,
|
|
35
36
|
});
|
|
36
37
|
const commits = res.search.nodes.map((pullRequestNode) => {
|
|
37
38
|
const sourceCommit = pullRequestNode.mergeCommit;
|
|
@@ -57,12 +57,20 @@ describe('fetchPullRequestBySearchQuery', () => {
|
|
|
57
57
|
state: 'MERGED',
|
|
58
58
|
number: 6,
|
|
59
59
|
url: 'https://github.com/backport-org/backport-e2e/pull/6',
|
|
60
|
+
mergeCommit: {
|
|
61
|
+
message: 'Add 🍏 emoji (#5) (#6)',
|
|
62
|
+
sha: '4bcd876d4ceaa73cf437bfc89b74d1a4e704c0a6',
|
|
63
|
+
},
|
|
60
64
|
},
|
|
61
65
|
{
|
|
62
66
|
branch: '7.8',
|
|
63
67
|
state: 'MERGED',
|
|
64
68
|
number: 7,
|
|
65
69
|
url: 'https://github.com/backport-org/backport-e2e/pull/7',
|
|
70
|
+
mergeCommit: {
|
|
71
|
+
message: 'Add 🍏 emoji (#5) (#7)',
|
|
72
|
+
sha: '46cd6f9999effdf894a36dbc7db90e890f4be840',
|
|
73
|
+
},
|
|
66
74
|
},
|
|
67
75
|
],
|
|
68
76
|
originalMessage: 'Add 🍏 emoji (#5)',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.fetchRemoteProjectConfig = void 0;
|
|
4
4
|
const readConfigFile_1 = require("../../../options/config/readConfigFile");
|
|
5
5
|
const apiRequestV4_1 = require("./apiRequestV4");
|
|
6
|
-
async function
|
|
6
|
+
async function fetchRemoteProjectConfig(options) {
|
|
7
7
|
const { accessToken, githubApiBaseUrlV4, repoName, repoOwner, sourceBranch } = options;
|
|
8
8
|
const query = /* GraphQL */ `
|
|
9
9
|
query ProjectConfig(
|
|
@@ -53,4 +53,4 @@ async function fetchProjectConfig(options) {
|
|
|
53
53
|
throw new Error('Project config does not exist');
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
exports.
|
|
56
|
+
exports.fetchRemoteProjectConfig = fetchRemoteProjectConfig;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
4
|
-
const
|
|
5
|
-
describe('
|
|
4
|
+
const fetchRemoteProjectConfig_1 = require("./fetchRemoteProjectConfig");
|
|
5
|
+
describe('fetchRemoteProjectConfig', () => {
|
|
6
6
|
let devAccessToken;
|
|
7
7
|
beforeEach(async () => {
|
|
8
8
|
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
9
|
});
|
|
10
10
|
it('returns the backport config from "main" branch', async () => {
|
|
11
|
-
const projectConfig = await (0,
|
|
11
|
+
const projectConfig = await (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
12
12
|
repoOwner: 'backport-org',
|
|
13
13
|
repoName: 'repo-with-project-config',
|
|
14
14
|
accessToken: devAccessToken,
|
|
@@ -28,7 +28,7 @@ describe('fetchProjectConfig', () => {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
it('returns the backport config from "branch-with-legacy-config" branch', async () => {
|
|
31
|
-
const projectConfig = await (0,
|
|
31
|
+
const projectConfig = await (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
32
32
|
repoOwner: 'backport-org',
|
|
33
33
|
repoName: 'repo-with-project-config',
|
|
34
34
|
accessToken: devAccessToken,
|
|
@@ -41,7 +41,7 @@ describe('fetchProjectConfig', () => {
|
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
43
|
it('throws an error if config does not exist', async () => {
|
|
44
|
-
const promise = (0,
|
|
44
|
+
const promise = (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
45
45
|
repoOwner: 'backport-org',
|
|
46
46
|
repoName: 'repo-with-project-config',
|
|
47
47
|
accessToken: devAccessToken,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConfigFileOptions } from '../../../entrypoint.module';
|
|
2
|
+
export declare function fetchRemoteProjectConfig(options: {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
githubApiBaseUrlV4?: string;
|
|
5
|
+
repoName: string;
|
|
6
|
+
repoOwner: string;
|
|
7
|
+
sourceBranch: string;
|
|
8
|
+
}): Promise<ConfigFileOptions>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchRemoteProjectConfig = void 0;
|
|
4
|
+
const readConfigFile_1 = require("../../../options/config/readConfigFile");
|
|
5
|
+
const apiRequestV4_1 = require("./apiRequestV4");
|
|
6
|
+
async function fetchRemoteProjectConfig(options) {
|
|
7
|
+
const { accessToken, githubApiBaseUrlV4, repoName, repoOwner, sourceBranch } = options;
|
|
8
|
+
const query = /* GraphQL */ `
|
|
9
|
+
query ProjectConfig(
|
|
10
|
+
$repoOwner: String!
|
|
11
|
+
$repoName: String!
|
|
12
|
+
$sourceBranch: String!
|
|
13
|
+
) {
|
|
14
|
+
repository(owner: $repoOwner, name: $repoName) {
|
|
15
|
+
ref(qualifiedName: $sourceBranch) {
|
|
16
|
+
target {
|
|
17
|
+
... on Commit {
|
|
18
|
+
history(first: 1, path: ".backportrc.json") {
|
|
19
|
+
edges {
|
|
20
|
+
remoteConfig: node {
|
|
21
|
+
file(path: ".backportrc.json") {
|
|
22
|
+
... on TreeEntry {
|
|
23
|
+
object {
|
|
24
|
+
... on Blob {
|
|
25
|
+
text
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
try {
|
|
40
|
+
const res = await (0, apiRequestV4_1.apiRequestV4)({
|
|
41
|
+
githubApiBaseUrlV4,
|
|
42
|
+
accessToken,
|
|
43
|
+
query,
|
|
44
|
+
variables: {
|
|
45
|
+
repoOwner,
|
|
46
|
+
repoName,
|
|
47
|
+
sourceBranch,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return (0, readConfigFile_1.withConfigMigrations)(JSON.parse(res.repository.ref.target.history.edges[0].remoteConfig.file.object.text));
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
throw new Error('Project config does not exist');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.fetchRemoteProjectConfig = fetchRemoteProjectConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|