Skip to main content

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

Parameter

Type

Description

url

string

A URL pointing to a file

config

GithubIntegrationConfig

The relevant provider config

credentials

GithubCredentials

**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