backport 8.8.0 → 8.9.0-beta.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/dist/entrypoint.module.d.ts +3 -1
- package/dist/entrypoint.module.js +4 -3
- package/dist/lib/sourceCommit/getPullRequestStates.d.ts +7 -0
- package/dist/lib/sourceCommit/getPullRequestStates.js +2 -1
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +1 -1
- package/dist/lib/github/v4/fetchRemoteProjectConfig.d.ts +0 -8
- package/dist/lib/github/v4/fetchRemoteProjectConfig.js +0 -49
- package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.d.ts +0 -1
- package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.js +0 -49
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { BackportResponse } from './backportRun';
|
|
2
|
+
import { getOptionsFromGithub } from './lib/github/v4/getOptionsFromGithub/getOptionsFromGithub';
|
|
2
3
|
import type { Commit } from './lib/sourceCommit/parseSourceCommit';
|
|
3
4
|
import { ConfigFileOptions } from './options/ConfigOptions';
|
|
4
5
|
import { ValidConfigOptions } from './options/options';
|
|
5
6
|
export type { HandledErrorResult, SuccessResult, UnhandledErrorResult, } from './runSequentially';
|
|
6
7
|
export type { BackportAbortResponse, BackportFailureResponse, BackportResponse, BackportSuccessResponse, } from './backportRun';
|
|
8
|
+
export { getTargetBranchFromLabel } from './lib/sourceCommit/getPullRequestStates';
|
|
7
9
|
export { BackportError } from './lib/BackportError';
|
|
8
10
|
export type { Commit } from './lib/sourceCommit/parseSourceCommit';
|
|
9
11
|
export type { ConfigFileOptions } from './options/ConfigOptions';
|
|
10
|
-
export { fetchRemoteProjectConfig as getRemoteProjectConfig } from './lib/github/v4/fetchRemoteProjectConfig';
|
|
11
12
|
export { getGlobalConfig as getLocalGlobalConfig } from './options/config/globalConfig';
|
|
13
|
+
export { getOptionsFromGithub };
|
|
12
14
|
export declare function backportRun({ options, processArgs, exitCodeOnFailure, }: {
|
|
13
15
|
options?: ConfigFileOptions;
|
|
14
16
|
processArgs?: string[];
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCommits = exports.backportRun = exports.
|
|
3
|
+
exports.getCommits = exports.backportRun = exports.getOptionsFromGithub = exports.getLocalGlobalConfig = exports.BackportError = exports.getTargetBranchFromLabel = void 0;
|
|
4
4
|
const backportRun_1 = require("./backportRun");
|
|
5
5
|
const fetchCommitByPullNumber_1 = require("./lib/github/v4/fetchCommits/fetchCommitByPullNumber");
|
|
6
6
|
const fetchCommitBySha_1 = require("./lib/github/v4/fetchCommits/fetchCommitBySha");
|
|
7
7
|
const fetchCommitsByAuthor_1 = require("./lib/github/v4/fetchCommits/fetchCommitsByAuthor");
|
|
8
8
|
const fetchPullRequestsBySearchQuery_1 = require("./lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery");
|
|
9
9
|
const getOptionsFromGithub_1 = require("./lib/github/v4/getOptionsFromGithub/getOptionsFromGithub");
|
|
10
|
+
Object.defineProperty(exports, "getOptionsFromGithub", { enumerable: true, get: function () { return getOptionsFromGithub_1.getOptionsFromGithub; } });
|
|
10
11
|
const logger_1 = require("./lib/logger");
|
|
11
12
|
const excludeUndefined_1 = require("./utils/excludeUndefined");
|
|
13
|
+
var getPullRequestStates_1 = require("./lib/sourceCommit/getPullRequestStates");
|
|
14
|
+
Object.defineProperty(exports, "getTargetBranchFromLabel", { enumerable: true, get: function () { return getPullRequestStates_1.getTargetBranchFromLabel; } });
|
|
12
15
|
var BackportError_1 = require("./lib/BackportError");
|
|
13
16
|
Object.defineProperty(exports, "BackportError", { enumerable: true, get: function () { return BackportError_1.BackportError; } });
|
|
14
|
-
var fetchRemoteProjectConfig_1 = require("./lib/github/v4/fetchRemoteProjectConfig");
|
|
15
|
-
Object.defineProperty(exports, "getRemoteProjectConfig", { enumerable: true, get: function () { return fetchRemoteProjectConfig_1.fetchRemoteProjectConfig; } });
|
|
16
17
|
var globalConfig_1 = require("./options/config/globalConfig");
|
|
17
18
|
Object.defineProperty(exports, "getLocalGlobalConfig", { enumerable: true, get: function () { return globalConfig_1.getGlobalConfig; } });
|
|
18
19
|
function backportRun({ options = {}, processArgs = [], exitCodeOnFailure = true, }) {
|
|
@@ -25,4 +25,11 @@ export declare function getPullRequestStates({ sourceCommit, branchLabelMapping,
|
|
|
25
25
|
sourceCommit: SourceCommitWithTargetPullRequest;
|
|
26
26
|
branchLabelMapping: ValidConfigOptions['branchLabelMapping'];
|
|
27
27
|
}): TargetPullRequest[];
|
|
28
|
+
export declare function getTargetBranchFromLabel({ branchLabelMapping, label, }: {
|
|
29
|
+
branchLabelMapping: NonNullable<ValidConfigOptions['branchLabelMapping']>;
|
|
30
|
+
label: string;
|
|
31
|
+
}): {
|
|
32
|
+
targetBranch: string;
|
|
33
|
+
labelRegex: string;
|
|
34
|
+
} | undefined;
|
|
28
35
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPullRequestStates = exports.getSourcePullRequest = void 0;
|
|
3
|
+
exports.getTargetBranchFromLabel = exports.getPullRequestStates = exports.getSourcePullRequest = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const filterEmpty_1 = require("../../utils/filterEmpty");
|
|
6
6
|
const commitFormatters_1 = require("../github/commitFormatters");
|
|
@@ -128,3 +128,4 @@ function getTargetBranchFromLabel({ branchLabelMapping, label, }) {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
+
exports.getTargetBranchFromLabel = getTargetBranchFromLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "8.
|
|
1
|
+
export declare const PACKAGE_VERSION = "8.9.0-beta.1";
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
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 | undefined>;
|
|
@@ -1,49 +0,0 @@
|
|
|
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.fetchRemoteProjectConfig = void 0;
|
|
7
|
-
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
-
const remoteConfig_1 = require("../../remoteConfig");
|
|
9
|
-
const apiRequestV4_1 = require("./apiRequestV4");
|
|
10
|
-
async function fetchRemoteProjectConfig(options) {
|
|
11
|
-
const { accessToken, githubApiBaseUrlV4, repoName, repoOwner, sourceBranch } = options;
|
|
12
|
-
const query = (0, graphql_tag_1.default) `
|
|
13
|
-
query ProjectConfig(
|
|
14
|
-
$repoOwner: String!
|
|
15
|
-
$repoName: String!
|
|
16
|
-
$sourceBranch: String!
|
|
17
|
-
) {
|
|
18
|
-
repository(owner: $repoOwner, name: $repoName) {
|
|
19
|
-
ref(qualifiedName: $sourceBranch) {
|
|
20
|
-
target {
|
|
21
|
-
...RemoteConfigHistoryFragment
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
${remoteConfig_1.RemoteConfigHistoryFragment}
|
|
28
|
-
`;
|
|
29
|
-
try {
|
|
30
|
-
const res = await (0, apiRequestV4_1.apiRequestV4)({
|
|
31
|
-
githubApiBaseUrlV4,
|
|
32
|
-
accessToken,
|
|
33
|
-
query,
|
|
34
|
-
variables: {
|
|
35
|
-
repoOwner,
|
|
36
|
-
repoName,
|
|
37
|
-
sourceBranch,
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
const remoteConfig = res.repository.ref.target.remoteConfigHistory.edges?.[0].remoteConfig;
|
|
41
|
-
if (remoteConfig) {
|
|
42
|
-
return (0, remoteConfig_1.parseRemoteConfig)(remoteConfig);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
throw new Error('Project config does not exist');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.fetchRemoteProjectConfig = fetchRemoteProjectConfig;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
4
|
-
const fetchRemoteProjectConfig_1 = require("./fetchRemoteProjectConfig");
|
|
5
|
-
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
6
|
-
describe('fetchRemoteProjectConfig', () => {
|
|
7
|
-
it('returns the backport config from "main" branch', async () => {
|
|
8
|
-
const projectConfig = await (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
9
|
-
repoOwner: 'backport-org',
|
|
10
|
-
repoName: 'repo-with-project-config',
|
|
11
|
-
accessToken,
|
|
12
|
-
sourceBranch: 'main',
|
|
13
|
-
});
|
|
14
|
-
expect(projectConfig).toEqual({
|
|
15
|
-
autoMerge: true,
|
|
16
|
-
autoMergeMethod: 'squash',
|
|
17
|
-
branchLabelMapping: {
|
|
18
|
-
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
19
|
-
'^v8.1.0$': 'main',
|
|
20
|
-
},
|
|
21
|
-
targetBranchChoices: ['main', '8.0', '7.17', '7.16'],
|
|
22
|
-
targetPRLabels: ['backport'],
|
|
23
|
-
repoOwner: 'backport-org',
|
|
24
|
-
repoName: 'repo-with-project-config',
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
it('returns the backport config from "branch-with-legacy-config" branch', async () => {
|
|
28
|
-
const projectConfig = await (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
29
|
-
repoOwner: 'backport-org',
|
|
30
|
-
repoName: 'repo-with-project-config',
|
|
31
|
-
accessToken,
|
|
32
|
-
sourceBranch: 'branch-with-legacy-config',
|
|
33
|
-
});
|
|
34
|
-
expect(projectConfig).toEqual({
|
|
35
|
-
targetBranchChoices: ['main', '8.0', '7.17', '7.16'],
|
|
36
|
-
repoOwner: 'backport-org',
|
|
37
|
-
repoName: 'repo-with-project-config',
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
it('throws an error if config does not exist', async () => {
|
|
41
|
-
const promise = (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
42
|
-
repoOwner: 'backport-org',
|
|
43
|
-
repoName: 'repo-with-project-config',
|
|
44
|
-
accessToken,
|
|
45
|
-
sourceBranch: 'branch-with-no-config',
|
|
46
|
-
});
|
|
47
|
-
await expect(promise).rejects.toThrowError('Project config does not exist');
|
|
48
|
-
});
|
|
49
|
-
});
|