Skip to content

Commit

Permalink
refactor(platform): rename addPr to setPr (#33174)
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulGautamSingh authored Dec 17, 2024
1 parent 8ae7448 commit 92ac488
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/modules/platform/bitbucket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ export async function createPr({
)
).body;
const pr = utils.prInfo(prRes);
await BitbucketPrCache.addPr(
await BitbucketPrCache.setPr(
bitbucketHttp,
config.repository,
renovateUserUuid,
Expand Down Expand Up @@ -949,7 +949,7 @@ export async function createPr({
)
).body;
const pr = utils.prInfo(prRes);
await BitbucketPrCache.addPr(
await BitbucketPrCache.setPr(
bitbucketHttp,
config.repository,
renovateUserUuid,
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/platform/bitbucket/pr-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,19 @@ export class BitbucketPrCache {
return prCache.getPrs();
}

private addPr(pr: Pr): void {
private setPr(pr: Pr): void {
logger.debug(`Adding PR #${pr.number} to the PR cache`);
this.cache.items[pr.number] = pr;
}

static async addPr(
static async setPr(
http: BitbucketHttp,
repo: string,
author: string | null,
item: Pr,
): Promise<void> {
const prCache = await BitbucketPrCache.init(http, repo, author);
prCache.addPr(item);
prCache.setPr(item);
}

private reconcile(rawItems: PrResponse[]): void {
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/platform/gitea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ const platform: Platform = {

// Add pull request to cache for further lookups / queries
if (pr) {
await GiteaPrCache.addPr(giteaHttp, config.repository, botUserName, pr);
await GiteaPrCache.setPr(giteaHttp, config.repository, botUserName, pr);
}
}

Expand Down Expand Up @@ -580,7 +580,7 @@ const platform: Platform = {
throw new Error('Can not parse newly created Pull Request');
}

await GiteaPrCache.addPr(giteaHttp, config.repository, botUserName, pr);
await GiteaPrCache.setPr(giteaHttp, config.repository, botUserName, pr);
return pr;
} catch (err) {
// When the user manually deletes a branch from Renovate, the PR remains but is no longer linked to any branch. In
Expand Down Expand Up @@ -673,7 +673,7 @@ const platform: Platform = {
);
const pr = toRenovatePR(gpr, botUserName);
if (pr) {
await GiteaPrCache.addPr(giteaHttp, config.repository, botUserName, pr);
await GiteaPrCache.setPr(giteaHttp, config.repository, botUserName, pr);
}
},

Expand Down
6 changes: 3 additions & 3 deletions lib/modules/platform/gitea/pr-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ export class GiteaPrCache {
return prCache.getPrs();
}

private addPr(item: Pr): void {
private setPr(item: Pr): void {
this.cache.items[item.number] = item;
}

static async addPr(
static async setPr(
http: GiteaHttp,
repo: string,
author: string,
item: Pr,
): Promise<void> {
const prCache = await GiteaPrCache.init(http, repo, author);
prCache.addPr(item);
prCache.setPr(item);
}

private reconcile(rawItems: PR[]): boolean {
Expand Down

0 comments on commit 92ac488

Please sign in to comment.