From 92ac488836f2c5438f10f068b02f166ad86c40d8 Mon Sep 17 00:00:00 2001 From: RahulGautamSingh Date: Wed, 18 Dec 2024 00:52:20 +0530 Subject: refactor(platform): rename `addPr` to `setPr` (#33174) --- lib/modules/platform/bitbucket/index.ts | 4 ++-- lib/modules/platform/bitbucket/pr-cache.ts | 6 +++--- lib/modules/platform/gitea/index.ts | 6 +++--- lib/modules/platform/gitea/pr-cache.ts | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/modules/platform/bitbucket/index.ts b/lib/modules/platform/bitbucket/index.ts index 9678aa2443b..35d125ffda8 100644 --- a/lib/modules/platform/bitbucket/index.ts +++ b/lib/modules/platform/bitbucket/index.ts @@ -919,7 +919,7 @@ export async function createPr({ ) ).body; const pr = utils.prInfo(prRes); - await BitbucketPrCache.addPr( + await BitbucketPrCache.setPr( bitbucketHttp, config.repository, renovateUserUuid, @@ -949,7 +949,7 @@ export async function createPr({ ) ).body; const pr = utils.prInfo(prRes); - await BitbucketPrCache.addPr( + await BitbucketPrCache.setPr( bitbucketHttp, config.repository, renovateUserUuid, diff --git a/lib/modules/platform/bitbucket/pr-cache.ts b/lib/modules/platform/bitbucket/pr-cache.ts index a270f45b6aa..45ac62b30f0 100644 --- a/lib/modules/platform/bitbucket/pr-cache.ts +++ b/lib/modules/platform/bitbucket/pr-cache.ts @@ -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 { const prCache = await BitbucketPrCache.init(http, repo, author); - prCache.addPr(item); + prCache.setPr(item); } private reconcile(rawItems: PrResponse[]): void { diff --git a/lib/modules/platform/gitea/index.ts b/lib/modules/platform/gitea/index.ts index d67cf0ceea2..697be51f84b 100644 --- a/lib/modules/platform/gitea/index.ts +++ b/lib/modules/platform/gitea/index.ts @@ -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); } } @@ -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 @@ -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); } }, diff --git a/lib/modules/platform/gitea/pr-cache.ts b/lib/modules/platform/gitea/pr-cache.ts index d3192d767e1..b26085d97a9 100644 --- a/lib/modules/platform/gitea/pr-cache.ts +++ b/lib/modules/platform/gitea/pr-cache.ts @@ -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 { const prCache = await GiteaPrCache.init(http, repo, author); - prCache.addPr(item); + prCache.setPr(item); } private reconcile(rawItems: PR[]): boolean { -- cgit v1.2.3