backport 8.8.0 → 8.9.0
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 +9 -3
- package/dist/entrypoint.module.d.ts +3 -1
- package/dist/entrypoint.module.js +6 -4
- package/dist/lib/cherrypickAndCreateTargetPullRequest/autoMergeNowOrLater.d.ts +2 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest/autoMergeNowOrLater.js +52 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest/cherrypickAndCreateTargetPullRequest.js +2 -2
- package/dist/lib/getCommits.js +2 -1
- package/dist/lib/github/v3/mergePullRequest.d.ts +6 -0
- package/dist/lib/github/v3/mergePullRequest.js +19 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.js +10 -27
- package/dist/lib/github/v4/enablePullRequestAutoMerge.mutation.test.js +87 -58
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +2 -2
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +2 -2
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.js +34 -10
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +8 -8
- package/dist/lib/github/v4/fetchCommits/fetchCommitsForRebaseAndMergeStrategy.d.ts +9 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsForRebaseAndMergeStrategy.js +78 -0
- package/dist/lib/github/v4/{fetchRemoteProjectConfig.private.test.d.ts → fetchCommits/fetchCommitsForRebaseAndMergeStrategy.private.test.d.ts} +0 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsForRebaseAndMergeStrategy.private.test.js +29 -0
- package/dist/lib/sourceCommit/getPullRequestStates.d.ts +7 -0
- package/dist/lib/sourceCommit/getPullRequestStates.js +2 -1
- package/dist/test/e2e/cli/different-merge-strategies.private.test.js +57 -23
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +13 -13
- package/yarn.lock +266 -254
- 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.js +0 -49
|
@@ -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,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
|
-
});
|