Skip to content

Commit

Permalink
processor: fix Github Actions status badges urls
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdulrhmnGhanem committed Sep 28, 2022
1 parent b00409c commit 165e418
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions processor/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ export function toGitHubRawUrl(url: string) {
if (parsedUrl.hostname === 'github.com') {
parsedUrl.hostname = 'raw.githubusercontent.com'
const urlPath = parsedUrl.pathname.split('/')
// Remove `/blob/` or '/raw/' from the path.
parsedUrl.pathname = urlPath.slice(0, 3).concat(urlPath.slice(4)).join('/')
url = parsedUrl.toString()
// Avoid using modifying github actions status badges.
const isWorkflowPath = urlPath?.[3] === 'workflows'

if (!isWorkflowPath) {
// Remove `/blob/` or '/raw/' from the path.
parsedUrl.pathname = urlPath.slice(0, 3).concat(urlPath.slice(4)).join('/')
url = parsedUrl.toString()
}
}
return url
}

0 comments on commit 165e418

Please sign in to comment.