Skip to main content
Version: Next

getGithubFileFetchUrl()

Home > @backstage/integration > getGithubFileFetchUrl

Given a URL pointing to a file on a provider, returns a URL that is suitable for fetching the contents of the data.

Signature:

function getGithubFileFetchUrl(url: string, config: GithubIntegrationConfig, credentials: GithubCredentials): string;

Parameters

ParameterTypeDescription
urlstringA URL pointing to a file
configGithubIntegrationConfigThe relevant provider config
credentialsGithubCredentials

Returns:

string

Remarks

Converts from: https://github.com/a/b/blob/branchname/path/to/c.yaml to: https://api.github.com/repos/a/b/contents/path/to/c.yaml?ref=branchname or: https://raw.githubusercontent.com/a/b/branchname/c.yaml