renovate 44.72.0 → 44.73.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/dist/modules/platform/github/graphql.js +17 -1
- package/dist/modules/platform/github/graphql.js.map +1 -1
- package/dist/modules/platform/github/index.js +41 -6
- package/dist/modules/platform/github/index.js.map +1 -1
- package/dist/modules/platform/gitlab/index.d.ts +13 -1
- package/dist/modules/platform/gitlab/index.js +39 -3
- package/dist/modules/platform/gitlab/index.js.map +1 -1
- package/dist/modules/platform/gitlab/schema.js +11 -1
- package/dist/modules/platform/gitlab/schema.js.map +1 -1
- package/dist/modules/platform/types.d.ts +15 -0
- package/dist/workers/repository/update/branch/automerge.js +7 -0
- package/dist/workers/repository/update/branch/automerge.js.map +1 -1
- package/dist/workers/repository/update/branch/index.js +1 -1
- package/dist/workers/repository/update/branch/index.js.map +1 -1
- package/dist/workers/repository/update/branch/reuse.js +5 -2
- package/dist/workers/repository/update/branch/reuse.js.map +1 -1
- package/dist/workers/repository/update/pr/automerge.js +18 -0
- package/dist/workers/repository/update/pr/automerge.js.map +1 -1
- package/dist/workers/repository/update/pr/index.js +1 -0
- package/dist/workers/repository/update/pr/index.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
|
@@ -87,6 +87,22 @@ query($owner: String!, $name: String!, $number: Int!) {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
`;
|
|
90
|
+
const enqueuePullRequestMutation = `
|
|
91
|
+
mutation EnqueuePullRequest(
|
|
92
|
+
$pullRequestId: ID!,
|
|
93
|
+
) {
|
|
94
|
+
enqueuePullRequest(
|
|
95
|
+
input: {
|
|
96
|
+
pullRequestId: $pullRequestId,
|
|
97
|
+
}
|
|
98
|
+
) {
|
|
99
|
+
mergeQueueEntry {
|
|
100
|
+
id
|
|
101
|
+
position
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
90
106
|
const enableAutoMergeMutation = `
|
|
91
107
|
mutation EnablePullRequestAutoMerge(
|
|
92
108
|
$pullRequestId: ID!,
|
|
@@ -109,6 +125,6 @@ mutation EnablePullRequestAutoMerge(
|
|
|
109
125
|
}
|
|
110
126
|
`;
|
|
111
127
|
//#endregion
|
|
112
|
-
export { enableAutoMergeMutation, getIssuesQuery, prIsInMergeQueueQuery, repoInfoQuery, repoMergeQueueQuery };
|
|
128
|
+
export { enableAutoMergeMutation, enqueuePullRequestMutation, getIssuesQuery, prIsInMergeQueueQuery, repoInfoQuery, repoMergeQueueQuery };
|
|
113
129
|
|
|
114
130
|
//# sourceMappingURL=graphql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.js","names":[],"sources":["../../../../lib/modules/platform/github/graphql.ts"],"sourcesContent":["export const repoInfoQuery = `\nquery($owner: String!, $name: String!, $user: String) {\n repository(owner: $owner, name: $name) {\n id\n sshUrl\n isFork\n parent {\n nameWithOwner\n }\n isArchived\n nameWithOwner\n hasIssuesEnabled\n hasVulnerabilityAlertsEnabled\n autoMergeAllowed\n mergeCommitAllowed\n rebaseMergeAllowed\n squashMergeAllowed\n mergeQueue { id }\n defaultBranchRef {\n name\n target {\n oid\n }\n }\n issues(\n orderBy: { field: UPDATED_AT, direction: DESC },\n filterBy: { createdBy: $user },\n first: 5\n ) {\n nodes {\n number\n state\n title\n body\n updatedAt\n }\n }\n }\n}\n`;\n\nexport const getIssuesQuery = `\nquery(\n $owner: String!,\n $name: String!,\n $user: String,\n $count: Int,\n $cursor: String\n) {\n repository(owner: $owner, name: $name) {\n issues(\n orderBy: { field: UPDATED_AT, direction: DESC },\n filterBy: { createdBy: $user },\n first: $count,\n after: $cursor\n ) {\n pageInfo {\n endCursor\n hasNextPage\n }\n nodes {\n number\n state\n title\n body\n updatedAt\n }\n }\n }\n}\n`;\n\nexport const repoMergeQueueQuery = `\nquery($owner: String!, $name: String!, $branch: String!) {\n repository(owner: $owner, name: $name) {\n mergeQueue(branch: $branch) {\n id\n }\n }\n}\n`;\n\nexport const prIsInMergeQueueQuery = `\nquery($owner: String!, $name: String!, $number: Int!) {\n repository(owner: $owner, name: $name) {\n pullRequest(number: $number) {\n isInMergeQueue\n }\n }\n}\n`;\n\nexport const enableAutoMergeMutation = `\nmutation EnablePullRequestAutoMerge(\n $pullRequestId: ID!,\n $mergeMethod: PullRequestMergeMethod!,\n $commitHeadline: String,\n $commitBody: String,\n) {\n enablePullRequestAutoMerge(\n input: {\n pullRequestId: $pullRequestId,\n mergeMethod: $mergeMethod,\n commitHeadline: $commitHeadline,\n commitBody: $commitBody,\n }\n ) {\n pullRequest {\n number\n }\n }\n}\n`;\n"],"mappings":";AAAA,MAAa,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyC7B,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B9B,MAAa,sBAAsB;;;;;;;;;AAUnC,MAAa,wBAAwB;;;;;;;;;AAUrC,MAAa,0BAA0B"}
|
|
1
|
+
{"version":3,"file":"graphql.js","names":[],"sources":["../../../../lib/modules/platform/github/graphql.ts"],"sourcesContent":["export const repoInfoQuery = `\nquery($owner: String!, $name: String!, $user: String) {\n repository(owner: $owner, name: $name) {\n id\n sshUrl\n isFork\n parent {\n nameWithOwner\n }\n isArchived\n nameWithOwner\n hasIssuesEnabled\n hasVulnerabilityAlertsEnabled\n autoMergeAllowed\n mergeCommitAllowed\n rebaseMergeAllowed\n squashMergeAllowed\n mergeQueue { id }\n defaultBranchRef {\n name\n target {\n oid\n }\n }\n issues(\n orderBy: { field: UPDATED_AT, direction: DESC },\n filterBy: { createdBy: $user },\n first: 5\n ) {\n nodes {\n number\n state\n title\n body\n updatedAt\n }\n }\n }\n}\n`;\n\nexport const getIssuesQuery = `\nquery(\n $owner: String!,\n $name: String!,\n $user: String,\n $count: Int,\n $cursor: String\n) {\n repository(owner: $owner, name: $name) {\n issues(\n orderBy: { field: UPDATED_AT, direction: DESC },\n filterBy: { createdBy: $user },\n first: $count,\n after: $cursor\n ) {\n pageInfo {\n endCursor\n hasNextPage\n }\n nodes {\n number\n state\n title\n body\n updatedAt\n }\n }\n }\n}\n`;\n\nexport const repoMergeQueueQuery = `\nquery($owner: String!, $name: String!, $branch: String!) {\n repository(owner: $owner, name: $name) {\n mergeQueue(branch: $branch) {\n id\n }\n }\n}\n`;\n\nexport const prIsInMergeQueueQuery = `\nquery($owner: String!, $name: String!, $number: Int!) {\n repository(owner: $owner, name: $name) {\n pullRequest(number: $number) {\n isInMergeQueue\n }\n }\n}\n`;\n\nexport const enqueuePullRequestMutation = `\nmutation EnqueuePullRequest(\n $pullRequestId: ID!,\n) {\n enqueuePullRequest(\n input: {\n pullRequestId: $pullRequestId,\n }\n ) {\n mergeQueueEntry {\n id\n position\n }\n }\n}\n`;\n\nexport const enableAutoMergeMutation = `\nmutation EnablePullRequestAutoMerge(\n $pullRequestId: ID!,\n $mergeMethod: PullRequestMergeMethod!,\n $commitHeadline: String,\n $commitBody: String,\n) {\n enablePullRequestAutoMerge(\n input: {\n pullRequestId: $pullRequestId,\n mergeMethod: $mergeMethod,\n commitHeadline: $commitHeadline,\n commitBody: $commitBody,\n }\n ) {\n pullRequest {\n number\n }\n }\n}\n`;\n"],"mappings":";AAAA,MAAa,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyC7B,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B9B,MAAa,sBAAsB;;;;;;;;;AAUnC,MAAa,wBAAwB;;;;;;;;;AAUrC,MAAa,6BAA6B;;;;;;;;;;;;;;;;AAiB1C,MAAa,0BAA0B"}
|
|
@@ -28,10 +28,10 @@ import { repoFingerprint } from "../util.js";
|
|
|
28
28
|
import { smartTruncate } from "../utils/pr-body.js";
|
|
29
29
|
import { coerceRestPr, githubApi, mapMergeStartegy } from "./common.js";
|
|
30
30
|
import { remoteBranchExists } from "./branch.js";
|
|
31
|
-
import { enableAutoMergeMutation, getIssuesQuery, repoInfoQuery, repoMergeQueueQuery } from "./graphql.js";
|
|
31
|
+
import { enableAutoMergeMutation, enqueuePullRequestMutation, getIssuesQuery, repoInfoQuery, repoMergeQueueQuery } from "./graphql.js";
|
|
32
32
|
import { GithubIssueCache } from "./issue.js";
|
|
33
33
|
import { massageMarkdownLinks } from "./massage-markdown-links.js";
|
|
34
|
-
import { getPrCache, isPrInMergeQueue, updatePrCache } from "./pr.js";
|
|
34
|
+
import { getPrCache, isPrInMergeQueue as isPrInMergeQueue$1, updatePrCache } from "./pr.js";
|
|
35
35
|
import { getAppDetails, getUserDetails, getUserEmail } from "./user.js";
|
|
36
36
|
import { getRepoUrl, isGithubEnterpriseServer, warnIfDefaultGitAuthorEmail } from "./utils.js";
|
|
37
37
|
import { isArray, isNonEmptyObject, isNonEmptyString } from "@sindresorhus/is";
|
|
@@ -69,7 +69,9 @@ var github_exports = /* @__PURE__ */ __exportAll({
|
|
|
69
69
|
id: () => id,
|
|
70
70
|
initPlatform: () => initPlatform,
|
|
71
71
|
initRepo: () => initRepo,
|
|
72
|
+
isBranchMergeQueueEnabled: () => isBranchMergeQueueEnabled,
|
|
72
73
|
isGHApp: () => isGHApp,
|
|
74
|
+
isPrInMergeQueue: () => isPrInMergeQueue,
|
|
73
75
|
listForks: () => listForks,
|
|
74
76
|
massageMarkdown: () => massageMarkdown,
|
|
75
77
|
maxBodyLength: () => maxBodyLength,
|
|
@@ -1246,7 +1248,7 @@ async function createPr({ sourceBranch, targetBranch, prTitle: title, prBody: ra
|
|
|
1246
1248
|
cachePr(result);
|
|
1247
1249
|
return result;
|
|
1248
1250
|
}
|
|
1249
|
-
async function
|
|
1251
|
+
async function isBranchMergeQueueEnabled(baseBranch) {
|
|
1250
1252
|
const cachedResult = config.mergeQueueEnabled[baseBranch];
|
|
1251
1253
|
if (cachedResult !== void 0) return cachedResult;
|
|
1252
1254
|
if (isGithubEnterpriseServer(platformConfig.host) && semver.satisfies(platformConfig.host.version ?? "", "<3.12.0")) {
|
|
@@ -1279,14 +1281,17 @@ async function isMergeQueueEnabled(baseBranch) {
|
|
|
1279
1281
|
config.mergeQueueEnabled[baseBranch] = result;
|
|
1280
1282
|
return result;
|
|
1281
1283
|
}
|
|
1284
|
+
function isPrInMergeQueue(prNo) {
|
|
1285
|
+
return isPrInMergeQueue$1(githubApi, config.repositoryOwner, config.repositoryName, prNo);
|
|
1286
|
+
}
|
|
1282
1287
|
async function assertPrNotInMergeQueue(branchName, baseBranch) {
|
|
1283
|
-
if (!await
|
|
1288
|
+
if (!await isBranchMergeQueueEnabled(baseBranch ?? config.defaultBranch)) return;
|
|
1284
1289
|
const pr = await findPr({
|
|
1285
1290
|
branchName,
|
|
1286
1291
|
state: "open"
|
|
1287
1292
|
});
|
|
1288
1293
|
if (!pr) return;
|
|
1289
|
-
if (await isPrInMergeQueue(
|
|
1294
|
+
if (await isPrInMergeQueue(pr.number)) {
|
|
1290
1295
|
logger.debug(`PR #${pr.number} is in the merge queue - aborting push`);
|
|
1291
1296
|
throw new Error(PR_ALREADY_IN_MERGE_QUEUE);
|
|
1292
1297
|
}
|
|
@@ -1323,8 +1328,38 @@ async function reattemptPlatformAutomerge({ number, platformPrOptions }) {
|
|
|
1323
1328
|
logger.warn({ err }, "Error re-attempting PR platform automerge");
|
|
1324
1329
|
}
|
|
1325
1330
|
}
|
|
1331
|
+
async function tryEnqueuePr(pr) {
|
|
1332
|
+
const prNo = pr.number;
|
|
1333
|
+
try {
|
|
1334
|
+
const res = await githubApi.requestGraphql(enqueuePullRequestMutation, {
|
|
1335
|
+
variables: { pullRequestId: pr.node_id },
|
|
1336
|
+
count: 1
|
|
1337
|
+
});
|
|
1338
|
+
if (res?.errors) {
|
|
1339
|
+
if (res.errors.some((error) => regEx(/already.*queue/i).test(error.message))) {
|
|
1340
|
+
logger.debug(`PR #${prNo} is already in the merge queue`);
|
|
1341
|
+
return true;
|
|
1342
|
+
}
|
|
1343
|
+
logger.debug({
|
|
1344
|
+
prNumber: prNo,
|
|
1345
|
+
errors: res.errors
|
|
1346
|
+
}, "Failed to add PR to the merge queue");
|
|
1347
|
+
return false;
|
|
1348
|
+
}
|
|
1349
|
+
logger.debug(`PR #${prNo} added to the merge queue`);
|
|
1350
|
+
return true;
|
|
1351
|
+
} catch (err) {
|
|
1352
|
+
logger.warn({
|
|
1353
|
+
prNumber: prNo,
|
|
1354
|
+
err
|
|
1355
|
+
}, "Failed to add PR to the merge queue");
|
|
1356
|
+
return false;
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1326
1359
|
async function mergePr({ branchName, id: prNo, strategy }) {
|
|
1327
1360
|
logger.debug(`mergePr(${prNo}, ${branchName})`);
|
|
1361
|
+
const pr = await getPr(prNo);
|
|
1362
|
+
if (pr?.targetBranch && await isBranchMergeQueueEnabled(pr.targetBranch)) return tryEnqueuePr(pr);
|
|
1328
1363
|
const url = `repos/${config.parentRepo ?? config.repository}/pulls/${prNo}/merge`;
|
|
1329
1364
|
const options = { body: {} };
|
|
1330
1365
|
/* v8 ignore next -- fork mode is not exercised in mergePr specs */
|
|
@@ -1503,6 +1538,6 @@ async function commitFiles(config) {
|
|
|
1503
1538
|
return await fetchBranch(branchName);
|
|
1504
1539
|
}
|
|
1505
1540
|
//#endregion
|
|
1506
|
-
export { addAssignees, addLabels, addReviewers, assertPrNotInMergeQueue, commitFiles, createFork, createPr, deleteLabel, ensureComment, ensureCommentRemoval, ensureIssue, ensureIssueClosing, findFork, findIssue, findPr, getBranchForceRebase, getBranchPr, getBranchStatus, getBranchStatusCheck, getIssue, getIssueList, getJsonFile, getPr, getPrList, getRawFile, getRepos, getVulnerabilityAlerts, github_exports, id, initPlatform, initRepo, isGHApp, listForks, massageMarkdown, maxBodyLength, mergePr, reattemptPlatformAutomerge, resetConfigs, setBranchStatus, tryReuseAutoclosedPr, updatePr };
|
|
1541
|
+
export { addAssignees, addLabels, addReviewers, assertPrNotInMergeQueue, commitFiles, createFork, createPr, deleteLabel, ensureComment, ensureCommentRemoval, ensureIssue, ensureIssueClosing, findFork, findIssue, findPr, getBranchForceRebase, getBranchPr, getBranchStatus, getBranchStatusCheck, getIssue, getIssueList, getJsonFile, getPr, getPrList, getRawFile, getRepos, getVulnerabilityAlerts, github_exports, id, initPlatform, initRepo, isBranchMergeQueueEnabled, isGHApp, isPrInMergeQueue, listForks, massageMarkdown, maxBodyLength, mergePr, reattemptPlatformAutomerge, resetConfigs, setBranchStatus, tryReuseAutoclosedPr, updatePr };
|
|
1507
1542
|
|
|
1508
1543
|
//# sourceMappingURL=index.js.map
|