Skip to content

Commit 4b50202

Browse files
refactor: rename platformOptions -> platformPrOptions (#30173)
1 parent 1b3cc58 commit 4b50202

File tree

20 files changed

+98
-99
lines changed

20 files changed

+98
-99
lines changed

lib/modules/platform/azure/__snapshots__/index.spec.ts.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ exports[`modules/platform/azure/index initRepo should initialise the config for
203203
}
204204
`;
205205

206-
exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOptions) should close the PR 1`] = `
206+
exports[`modules/platform/azure/index updatePr(prNo, title, body, platformPrOptions) should close the PR 1`] = `
207207
[
208208
[
209209
{
@@ -217,9 +217,9 @@ exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOption
217217
]
218218
`;
219219

220-
exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOptions) should re-approve the PR 1`] = `undefined`;
220+
exports[`modules/platform/azure/index updatePr(prNo, title, body, platformPrOptions) should re-approve the PR 1`] = `undefined`;
221221

222-
exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOptions) should reopen the PR 1`] = `
222+
exports[`modules/platform/azure/index updatePr(prNo, title, body, platformPrOptions) should reopen the PR 1`] = `
223223
[
224224
[
225225
{
@@ -239,7 +239,7 @@ exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOption
239239
]
240240
`;
241241

242-
exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOptions) should update the PR 1`] = `
242+
exports[`modules/platform/azure/index updatePr(prNo, title, body, platformPrOptions) should update the PR 1`] = `
243243
[
244244
[
245245
{
@@ -253,7 +253,7 @@ exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOption
253253
]
254254
`;
255255

256-
exports[`modules/platform/azure/index updatePr(prNo, title, body, platformOptions) should update the PR without description 1`] = `
256+
exports[`modules/platform/azure/index updatePr(prNo, title, body, platformPrOptions) should update the PR without description 1`] = `
257257
[
258258
[
259259
{

lib/modules/platform/azure/index.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ describe('modules/platform/azure/index', () => {
925925
prTitle: 'The Title',
926926
prBody: 'Hello world',
927927
labels: ['deps', 'renovate'],
928-
platformOptions: { usePlatformAutomerge: true },
928+
platformPrOptions: { usePlatformAutomerge: true },
929929
});
930930
expect(updateFn).toHaveBeenCalled();
931931
expect(pr).toMatchSnapshot();
@@ -996,7 +996,7 @@ describe('modules/platform/azure/index', () => {
996996
prTitle: 'The Title',
997997
prBody: 'Hello world',
998998
labels: ['deps', 'renovate'],
999-
platformOptions: {
999+
platformPrOptions: {
10001000
automergeStrategy: 'auto',
10011001
usePlatformAutomerge: true,
10021002
},
@@ -1008,7 +1008,7 @@ describe('modules/platform/azure/index', () => {
10081008
prTitle: 'The Second Title',
10091009
prBody: 'Hello world',
10101010
labels: ['deps', 'renovate'],
1011-
platformOptions: {
1011+
platformPrOptions: {
10121012
automergeStrategy: 'auto',
10131013
usePlatformAutomerge: true,
10141014
},
@@ -1061,7 +1061,7 @@ describe('modules/platform/azure/index', () => {
10611061
prTitle: 'The Title',
10621062
prBody: 'Hello world',
10631063
labels: ['deps', 'renovate'],
1064-
platformOptions: {
1064+
platformPrOptions: {
10651065
automergeStrategy,
10661066
usePlatformAutomerge: true,
10671067
},
@@ -1113,7 +1113,7 @@ describe('modules/platform/azure/index', () => {
11131113
prTitle: 'The Title',
11141114
prBody: 'Hello world',
11151115
labels: ['deps', 'renovate'],
1116-
platformOptions: {
1116+
platformPrOptions: {
11171117
automergeStrategy,
11181118
usePlatformAutomerge: true,
11191119
},
@@ -1163,14 +1163,14 @@ describe('modules/platform/azure/index', () => {
11631163
prTitle: 'The Title',
11641164
prBody: 'Hello world',
11651165
labels: ['deps', 'renovate'],
1166-
platformOptions: { autoApprove: true },
1166+
platformPrOptions: { autoApprove: true },
11671167
});
11681168
expect(updateFn).toHaveBeenCalled();
11691169
expect(pr).toMatchSnapshot();
11701170
});
11711171
});
11721172

1173-
describe('updatePr(prNo, title, body, platformOptions)', () => {
1173+
describe('updatePr(prNo, title, body, platformPrOptions)', () => {
11741174
it('should update the PR', async () => {
11751175
await initRepo({ repository: 'some/repo' });
11761176
const updatePullRequest = jest.fn();
@@ -1272,7 +1272,7 @@ describe('modules/platform/azure/index', () => {
12721272
number: prResult.pullRequestId,
12731273
prTitle: 'The Title',
12741274
prBody: 'Hello world',
1275-
platformOptions: { autoApprove: true },
1275+
platformPrOptions: { autoApprove: true },
12761276
});
12771277
expect(updateFn).toHaveBeenCalled();
12781278
expect(pr).toMatchSnapshot();

lib/modules/platform/azure/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,15 @@ export async function createPr({
465465
prBody: body,
466466
labels,
467467
draftPR = false,
468-
platformOptions,
468+
platformPrOptions,
469469
}: CreatePRConfig): Promise<Pr> {
470470
const sourceRefName = getNewBranchName(sourceBranch);
471471
const targetRefName = getNewBranchName(targetBranch);
472472
const description = max4000Chars(sanitize(body));
473473
const azureApiGit = await azureApi.gitApi();
474474
const workItemRefs = [
475475
{
476-
id: platformOptions?.azureWorkItemId?.toString(),
476+
id: platformPrOptions?.azureWorkItemId?.toString(),
477477
},
478478
];
479479
let pr: GitPullRequest = await azureApiGit.createPullRequest(
@@ -487,11 +487,11 @@ export async function createPr({
487487
},
488488
config.repoId,
489489
);
490-
if (platformOptions?.usePlatformAutomerge) {
490+
if (platformPrOptions?.usePlatformAutomerge) {
491491
const mergeStrategy =
492-
platformOptions.automergeStrategy === 'auto'
492+
platformPrOptions.automergeStrategy === 'auto'
493493
? await getMergeStrategy(pr.targetRefName!)
494-
: mapMergeStrategy(platformOptions.automergeStrategy);
494+
: mapMergeStrategy(platformPrOptions.automergeStrategy);
495495
pr = await azureApiGit.updatePullRequest(
496496
{
497497
autoCompleteSetBy: {
@@ -509,7 +509,7 @@ export async function createPr({
509509
pr.pullRequestId!,
510510
);
511511
}
512-
if (platformOptions?.autoApprove) {
512+
if (platformPrOptions?.autoApprove) {
513513
await azureApiGit.createPullRequestReviewer(
514514
{
515515
reviewerUrl: pr.createdBy!.url,
@@ -543,7 +543,7 @@ export async function updatePr({
543543
prTitle: title,
544544
prBody: body,
545545
state,
546-
platformOptions,
546+
platformPrOptions,
547547
targetBranch,
548548
}: UpdatePrConfig): Promise<void> {
549549
logger.debug(`updatePr(${prNo}, ${title}, body)`);
@@ -572,7 +572,7 @@ export async function updatePr({
572572
} else if (state === 'closed') {
573573
objToUpdate.status = PullRequestStatus.Abandoned;
574574
}
575-
if (platformOptions?.autoApprove) {
575+
if (platformPrOptions?.autoApprove) {
576576
const pr = await azureApiGit.getPullRequestById(prNo, config.project);
577577
await azureApiGit.createPullRequestReviewer(
578578
{

lib/modules/platform/bitbucket-server/index.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ describe('modules/platform/bitbucket-server/index', () => {
14871487
targetBranch: 'master',
14881488
prTitle: 'title',
14891489
prBody: 'body',
1490-
platformOptions: {
1490+
platformPrOptions: {
14911491
bbUseDefaultReviewers: true,
14921492
},
14931493
});
@@ -1514,7 +1514,7 @@ describe('modules/platform/bitbucket-server/index', () => {
15141514
prTitle: 'title',
15151515
prBody: 'body',
15161516
labels: null,
1517-
platformOptions: {
1517+
platformPrOptions: {
15181518
bbUseDefaultReviewers: true,
15191519
},
15201520
});

lib/modules/platform/bitbucket-server/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,15 +865,14 @@ export async function createPr({
865865
targetBranch,
866866
prTitle: title,
867867
prBody: rawDescription,
868-
platformOptions,
868+
platformPrOptions,
869869
}: CreatePRConfig): Promise<Pr> {
870870
const description = sanitize(rawDescription);
871871
logger.debug(`createPr(${sourceBranch}, title=${title})`);
872872
const base = targetBranch;
873873
let reviewers: BbsRestUserRef[] = [];
874874

875-
/* istanbul ignore else */
876-
if (platformOptions?.bbUseDefaultReviewers) {
875+
if (platformPrOptions?.bbUseDefaultReviewers) {
877876
logger.debug(`fetching default reviewers`);
878877
const { id } = (
879878
await bitbucketServerHttp.getJson<{ id: number }>(

lib/modules/platform/bitbucket/index.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ describe('modules/platform/bitbucket/index', () => {
11051105
targetBranch: 'master',
11061106
prTitle: 'title',
11071107
prBody: 'body',
1108-
platformOptions: {
1108+
platformPrOptions: {
11091109
bbUseDefaultReviewers: true,
11101110
},
11111111
});
@@ -1188,7 +1188,7 @@ describe('modules/platform/bitbucket/index', () => {
11881188
targetBranch: 'master',
11891189
prTitle: 'title',
11901190
prBody: 'body',
1191-
platformOptions: {
1191+
platformPrOptions: {
11921192
bbUseDefaultReviewers: true,
11931193
},
11941194
});
@@ -1251,7 +1251,7 @@ describe('modules/platform/bitbucket/index', () => {
12511251
targetBranch: 'master',
12521252
prTitle: 'title',
12531253
prBody: 'body',
1254-
platformOptions: {
1254+
platformPrOptions: {
12551255
bbUseDefaultReviewers: true,
12561256
},
12571257
});
@@ -1297,7 +1297,7 @@ describe('modules/platform/bitbucket/index', () => {
12971297
targetBranch: 'master',
12981298
prTitle: 'title',
12991299
prBody: 'body',
1300-
platformOptions: {
1300+
platformPrOptions: {
13011301
bbUseDefaultReviewers: true,
13021302
},
13031303
}),
@@ -1352,7 +1352,7 @@ describe('modules/platform/bitbucket/index', () => {
13521352
targetBranch: 'master',
13531353
prTitle: 'title',
13541354
prBody: 'body',
1355-
platformOptions: {
1355+
platformPrOptions: {
13561356
bbUseDefaultReviewers: true,
13571357
},
13581358
});
@@ -1391,7 +1391,7 @@ describe('modules/platform/bitbucket/index', () => {
13911391
targetBranch: 'master',
13921392
prTitle: 'title',
13931393
prBody: 'body',
1394-
platformOptions: {
1394+
platformPrOptions: {
13951395
bbUseDefaultReviewers: true,
13961396
},
13971397
}),
@@ -1430,7 +1430,7 @@ describe('modules/platform/bitbucket/index', () => {
14301430
targetBranch: 'master',
14311431
prTitle: 'title',
14321432
prBody: 'body',
1433-
platformOptions: {
1433+
platformPrOptions: {
14341434
bbUseDefaultReviewers: true,
14351435
},
14361436
}),

lib/modules/platform/bitbucket/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ export async function createPr({
867867
targetBranch,
868868
prTitle: title,
869869
prBody: description,
870-
platformOptions,
870+
platformPrOptions,
871871
}: CreatePRConfig): Promise<Pr> {
872872
// labels is not supported in Bitbucket: https://bitbucket.org/site/master/issues/11976/ability-to-add-labels-to-pull-requests-bb
873873

@@ -877,7 +877,7 @@ export async function createPr({
877877

878878
let reviewers: Account[] = [];
879879

880-
if (platformOptions?.bbUseDefaultReviewers) {
880+
if (platformPrOptions?.bbUseDefaultReviewers) {
881881
const reviewersResponse = (
882882
await bitbucketHttp.getJson<PagedResult<EffectiveReviewer>>(
883883
`/2.0/repositories/${config.repository}/effective-default-reviewers`,

lib/modules/platform/gerrit/index.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ describe('modules/platform/gerrit/index', () => {
225225
await gerrit.updatePr({
226226
number: 123456,
227227
prTitle: 'subject',
228-
platformOptions: {
228+
platformPrOptions: {
229229
autoApprove: true,
230230
},
231231
});
@@ -338,7 +338,7 @@ describe('modules/platform/gerrit/index', () => {
338338
targetBranch: 'target',
339339
prTitle: 'title',
340340
prBody: 'body',
341-
platformOptions: {
341+
platformPrOptions: {
342342
autoApprove: false,
343343
},
344344
});
@@ -362,7 +362,7 @@ describe('modules/platform/gerrit/index', () => {
362362
targetBranch: 'target',
363363
prTitle: change.subject,
364364
prBody: 'body',
365-
platformOptions: {
365+
platformPrOptions: {
366366
autoApprove: true,
367367
},
368368
});

lib/modules/platform/gerrit/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export async function updatePr(prConfig: UpdatePrConfig): Promise<void> {
168168
TAG_PULL_REQUEST_BODY,
169169
);
170170
}
171-
if (prConfig.platformOptions?.autoApprove) {
171+
if (prConfig.platformPrOptions?.autoApprove) {
172172
await client.approveChange(prConfig.number);
173173
}
174174
if (prConfig.state && prConfig.state === 'closed') {
@@ -211,7 +211,7 @@ export async function createPr(prConfig: CreatePRConfig): Promise<Pr | null> {
211211
prConfig.prBody,
212212
TAG_PULL_REQUEST_BODY,
213213
);
214-
if (prConfig.platformOptions?.autoApprove) {
214+
if (prConfig.platformPrOptions?.autoApprove) {
215215
await client.approveChange(pr._number);
216216
}
217217
return getPr(pr._number);

lib/modules/platform/gitea/index.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ describe('modules/platform/gitea/index', () => {
16251625
targetBranch: 'master',
16261626
prTitle: mockNewPR.title,
16271627
prBody: mockNewPR.body,
1628-
platformOptions: { usePlatformAutomerge: true },
1628+
platformPrOptions: { usePlatformAutomerge: true },
16291629
});
16301630

16311631
expect(res).toMatchObject({
@@ -1653,7 +1653,7 @@ describe('modules/platform/gitea/index', () => {
16531653
targetBranch: 'master',
16541654
prTitle: mockNewPR.title,
16551655
prBody: mockNewPR.body,
1656-
platformOptions: { usePlatformAutomerge: true },
1656+
platformPrOptions: { usePlatformAutomerge: true },
16571657
});
16581658

16591659
expect(res).toMatchObject({
@@ -1681,7 +1681,7 @@ describe('modules/platform/gitea/index', () => {
16811681
targetBranch: 'master',
16821682
prTitle: mockNewPR.title,
16831683
prBody: mockNewPR.body,
1684-
platformOptions: { usePlatformAutomerge: true },
1684+
platformPrOptions: { usePlatformAutomerge: true },
16851685
});
16861686

16871687
expect(res).toMatchObject({
@@ -1707,7 +1707,7 @@ describe('modules/platform/gitea/index', () => {
17071707
targetBranch: 'master',
17081708
prTitle: mockNewPR.title,
17091709
prBody: mockNewPR.body,
1710-
platformOptions: { usePlatformAutomerge: true },
1710+
platformPrOptions: { usePlatformAutomerge: true },
17111711
});
17121712

17131713
expect(res).toMatchObject({
@@ -1734,7 +1734,7 @@ describe('modules/platform/gitea/index', () => {
17341734
targetBranch: 'master',
17351735
prTitle: mockNewPR.title,
17361736
prBody: mockNewPR.body,
1737-
platformOptions: { usePlatformAutomerge: true },
1737+
platformPrOptions: { usePlatformAutomerge: true },
17381738
});
17391739

17401740
expect(res).toMatchObject({
@@ -1763,7 +1763,7 @@ describe('modules/platform/gitea/index', () => {
17631763
targetBranch: 'master',
17641764
prTitle: mockNewPR.title,
17651765
prBody: mockNewPR.body,
1766-
platformOptions: {
1766+
platformPrOptions: {
17671767
automergeStrategy: 'auto',
17681768
usePlatformAutomerge: true,
17691769
},
@@ -1802,7 +1802,7 @@ describe('modules/platform/gitea/index', () => {
18021802
targetBranch: 'master',
18031803
prTitle: mockNewPR.title,
18041804
prBody: mockNewPR.body,
1805-
platformOptions: {
1805+
platformPrOptions: {
18061806
automergeStrategy,
18071807
usePlatformAutomerge: true,
18081808
},

0 commit comments

Comments
 (0)