From cb8d64dbe98111bd10383d395a92f3c47dec7f27 Mon Sep 17 00:00:00 2001 From: proton <25139420+proton-ab@users.noreply.github.com> Date: Thu, 18 Jun 2020 23:26:28 +0200 Subject: [PATCH] fix(gitea): remove immortal PR warning (#5999) --- lib/platform/gitea/README.md | 1 - lib/platform/gitea/index.spec.ts | 15 --------------- lib/platform/gitea/index.ts | 18 +----------------- 3 files changed, 1 insertion(+), 33 deletions(-) diff --git a/lib/platform/gitea/README.md b/lib/platform/gitea/README.md index c24a112da439b9..4b1acb81233c3f 100644 --- a/lib/platform/gitea/README.md +++ b/lib/platform/gitea/README.md @@ -5,4 +5,3 @@ Gitea support is considered in **beta** release status. Mostly, it just needs mo ## Unsupported platform features/concepts - **Adding reviewers to PRs not supported**: While Gitea supports a basic implementation for supporting PR reviews, no API support has been implemented so far. -- **Ignoring Renovate PRs by close**: As Gitea does not expose the branch name of a PR once it has been deleted, all issued pull requests are immortal. diff --git a/lib/platform/gitea/index.spec.ts b/lib/platform/gitea/index.spec.ts index 0a0ea9f36ccbd7..b44eddadda5a26 100644 --- a/lib/platform/gitea/index.spec.ts +++ b/lib/platform/gitea/index.spec.ts @@ -1247,21 +1247,6 @@ describe('platform/gitea', () => { expect(helper.updateComment).not.toHaveBeenCalled(); }); - it('should skip comments with topic "Renovate Ignore Notification"', async () => { - helper.getComments.mockResolvedValueOnce(mockComments); - - await initFakeRepo(); - const res = await gitea.ensureComment({ - number: 1, - topic: 'Renovate Ignore Notification', - content: 'this-should-be-ignored-as-a-workaround', - }); - - expect(res).toEqual(false); - expect(helper.createComment).not.toHaveBeenCalled(); - expect(helper.updateComment).not.toHaveBeenCalled(); - }); - it('should gracefully fail with warning', async () => { helper.getComments.mockRejectedValueOnce(new Error()); await initFakeRepo(); diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts index fcd45dc121c00b..2fea422ce91b7b 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -758,13 +758,6 @@ const platform: Platform = { topic, content, }: EnsureCommentConfig): Promise { - if (topic === 'Renovate Ignore Notification') { - logger.debug( - `Skipping ensureComment(${topic}) as ignoring PRs is unsupported on Gitea.` - ); - return false; - } - try { let body = sanitize(content); const commentList = await helper.getComments(config.repository, issue); @@ -870,16 +863,7 @@ const platform: Platform = { }, getPrBody(prBody: string): string { - // Gitea does not preserve the branch name once the head branch gets deleted, so ignoring a PR by simply closing it - // results in an endless loop of Renovate creating the PR over and over again. This is not pretty, but can not be - // avoided without storing that information somewhere else, so at least warn the user about it. - return smartTruncate( - prBody.replace( - /:no_bell: \*\*Ignore\*\*: Close this PR and you won't be reminded about (this update|these updates) again./, - `:ghost: **Immortal**: This PR will be recreated if closed unmerged, as Gitea does not support ignoring PRs.` - ), - 1000000 - ); + return smartTruncate(prBody, 1000000); }, isBranchStale(branchName: string): Promise {