mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
fix(github): don't match org name with underscore (#19071)
This commit is contained in:
parent
e82f6cd480
commit
4f71562e56
2 changed files with 4 additions and 1 deletions
|
@ -63,6 +63,7 @@ describe('modules/platform/github/massage-markdown-links', () => {
|
|||
${'github.com/foo/bar/issues/1'} | ${'[github.com/foo/bar/issues/1](togithub.com/foo/bar/issues/1)'}
|
||||
${'github.com/foo/bar/pull/1'} | ${'[github.com/foo/bar/pull/1](togithub.com/foo/bar/pull/1)'}
|
||||
${'github.com/Foo/bar/pull/1'} | ${'[github.com/Foo/bar/pull/1](togithub.com/Foo/bar/pull/1)'}
|
||||
${'www.github.com/foo/bar.foo/pull/1'} | ${'[www.github.com/foo/bar.foo/pull/1](www.togithub.com/foo/bar.foo/pull/1)'}
|
||||
${'www.github.com/foo/bar/discussions/1'} | ${'[www.github.com/foo/bar/discussions/1](www.togithub.com/foo/bar/discussions/1)'}
|
||||
${'www.github.com/foo/bar/issues/1'} | ${'[www.github.com/foo/bar/issues/1](www.togithub.com/foo/bar/issues/1)'}
|
||||
${'www.github.com/foo/bar/pull/1'} | ${'[www.github.com/foo/bar/pull/1](www.togithub.com/foo/bar/pull/1)'}
|
||||
|
@ -77,6 +78,7 @@ describe('modules/platform/github/massage-markdown-links', () => {
|
|||
${'[github.com/foo/bar/pull/1](github.com/foo/bar/pull/1)'} | ${'[github.com/foo/bar/pull/1](togithub.com/foo/bar/pull/1)'}
|
||||
${'[www.github.com/foo/bar/discussions/1](www.github.com/foo/bar/discussions/1)'} | ${'[www.github.com/foo/bar/discussions/1](www.togithub.com/foo/bar/discussions/1)'}
|
||||
${'[www.github.com/foo/bar/issues/1](www.github.com/foo/bar/issues/1)'} | ${'[www.github.com/foo/bar/issues/1](www.togithub.com/foo/bar/issues/1)'}
|
||||
${'[www.github.com/foo/bar.foo/pull/1](www.github.com/foo/bar.foo/pull/1)'} | ${'[www.github.com/foo/bar.foo/pull/1](www.togithub.com/foo/bar.foo/pull/1)'}
|
||||
${'[www.github.com/foo/bar/pull/1](www.github.com/foo/bar/pull/1)'} | ${'[www.github.com/foo/bar/pull/1](www.togithub.com/foo/bar/pull/1)'}
|
||||
${'[https://github.com/foo/bar/discussions/1](https://github.com/foo/bar/discussions/1)'} | ${'[https://github.com/foo/bar/discussions/1](https://togithub.com/foo/bar/discussions/1)'}
|
||||
${'[https://github.com/foo/bar/issues/1](https://github.com/foo/bar/issues/1)'} | ${'[https://github.com/foo/bar/issues/1](https://togithub.com/foo/bar/issues/1)'}
|
||||
|
|
|
@ -10,8 +10,9 @@ interface UrlMatch {
|
|||
replaceTo: string;
|
||||
}
|
||||
|
||||
//according to https://github.com/dead-claudia/github-limits
|
||||
const urlRegex =
|
||||
/(?:https?:)?(?:\/\/)?(?:www\.)?(?<!api\.)(?:to)?github\.com\/[-_a-z0-9]+\/[-_a-z0-9.]+\/(?:discussions|issues|pull)\/[0-9]+(?:#[-_a-z0-9]+)?/i; // TODO #12872 (?<!re) after text not matching
|
||||
/(?:https?:)?(?:\/\/)?(?:www\.)?(?<!api\.)(?:to)?github\.com\/[-a-z0-9]+\/[-_a-z0-9.]+\/(?:discussions|issues|pull)\/[0-9]+(?:#[-_a-z0-9]+)?/i; // TODO #12872 (?<!re) after text not matching
|
||||
|
||||
function massageLink(input: string): string {
|
||||
return input.replace(regEx(/(?:to)?github\.com/i), 'togithub.com');
|
||||
|
|
Loading…
Reference in a new issue