Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gitea): remove immortal PR warning #5999

Merged
merged 9 commits into from Jun 18, 2020
1 change: 0 additions & 1 deletion lib/platform/gitea/README.md
Expand Up @@ -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.
15 changes: 0 additions & 15 deletions lib/platform/gitea/index.spec.ts
Expand Up @@ -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();
Expand Down
18 changes: 1 addition & 17 deletions lib/platform/gitea/index.ts
Expand Up @@ -758,13 +758,6 @@ const platform: Platform = {
topic,
content,
}: EnsureCommentConfig): Promise<boolean> {
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);
Expand Down Expand Up @@ -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<boolean> {
Expand Down