Skip to content

Commit

Permalink
Drop support for labels
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Aug 26, 2024
1 parent 7c05f2c commit d12e857
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 0 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import reservedNames from 'github-reserved-names/reserved-names.json' with { typ

const patchDiffRegex = /[.](patch|diff)$/;
const releaseRegex = /^releases[/]tag[/]([^/]+)/;
const labelRegex = /^labels[/]([^/]+)/;
const compareRegex = /^compare[/]([^/]+)/;
const pullRegex = /^pull[/](?<pull>\d+)(?:[/](?<pullPage>[^/]+))?(?:[/](?<pullPartialStart>[\da-f]{40})[.][.](?<pullPartialEnd>[\da-f]{40}))?$/;
const issueRegex = /^issues[/](\d+)$/;
Expand Down Expand Up @@ -138,7 +137,6 @@ function shortenRepoUrl(href, currentUrl = 'https://github.com') {
const [, release] = repoPath.match(releaseRegex) || [];
const [, releaseTag, releaseTagExtension] = repoPath.match(releaseArchiveRegex) || [];
const [, downloadTag, downloadFilename] = repoPath.match(releaseDownloadRegex) || [];
const [, label] = repoPath.match(labelRegex) || [];
const [, compare] = repoPath.match(compareRegex) || [];
const {pull, pullPage, pullPartialStart, pullPartialEnd} = repoPath.match(pullRegex)?.groups ?? {};
const [, issue] = isRedirection ? repoPath.match(issueRegex) || [] : [];
Expand Down Expand Up @@ -222,13 +220,6 @@ function shortenRepoUrl(href, currentUrl = 'https://github.com') {
return `${partial} ${downloadFilename}${search}${hash} (download)`;
}

if (label) {
return (
joinValues([repoUrl, decodeURIComponent(label)])
+ `${search}${hash} (label)`
);
}

if (isDependents) {
return `${user}/${repo} (dependents)`;
}
Expand Down
2 changes: 2 additions & 0 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const urls = [
'https://github.com/nodejs/node/compare/master',
'https://github.com/nodejs/node/compare/master...master',
'https://github.com/nodejs/node/milestone/25',

// Labels are here for verification, but in GitHub has already been shortening them
'https://github.com/fregante/shorten-repo-url/labels/npm',
'https://github.com/nodejs/node/labels/npm',
'https://github.com/nodejs/node/labels/Please%21%20♥',
Expand Down

0 comments on commit d12e857

Please sign in to comment.