Skip to main content
Version: Next

parseGitilesUrlRef()

Home > @backstage/integration > parseGitilesUrlRef

Parses Gitiles urls and returns the following:

  • The project - The type of ref. I.e: branch name, SHA, HEAD or tag. - The file path from the repo root. - The base path as the path that points to the repo root.

Supported types of gitiles urls that point to:

  • Branches - Tags - A commit SHA - HEAD

Signature:

function parseGitilesUrlRef(config: GerritIntegrationConfig, url: string): {
project: string;
path: string;
ref: string;
refType: 'sha' | 'branch' | 'tag' | 'head';
basePath: string;
};

Parameters

ParameterTypeDescription
configGerritIntegrationConfigA Gerrit provider config.
urlstringAn url to a file or folder in Gitiles.

Returns:

{ project: string; path: string; ref: string; refType: 'sha' | 'branch' | 'tag' | 'head'; basePath: string; }