Merge pull request #23007 from deepan10/adr-issue-22102
Fixed: ADR file path in Azure DevOps
This commit is contained in:
@@ -25,6 +25,7 @@ export const ANNOTATION_ADR_LOCATION = 'backstage.io/adr-location';
|
||||
export const getAdrLocationUrl: (
|
||||
entity: Entity,
|
||||
scmIntegration: ScmIntegrationRegistry,
|
||||
adrFilePath?: String,
|
||||
) => string;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -57,13 +57,20 @@ export const isAdrAvailable = (entity: Entity) =>
|
||||
export const getAdrLocationUrl = (
|
||||
entity: Entity,
|
||||
scmIntegration: ScmIntegrationRegistry,
|
||||
adrFilePath?: String,
|
||||
) => {
|
||||
if (!isAdrAvailable(entity)) {
|
||||
throw new Error(`Missing ADR annotation: ${ANNOTATION_ADR_LOCATION}`);
|
||||
}
|
||||
|
||||
let url = getAdrLocationDir(entity)!.replace(/\/$/, '');
|
||||
|
||||
if (adrFilePath) {
|
||||
url = `${url}/${adrFilePath}`;
|
||||
}
|
||||
|
||||
return scmIntegration.resolveUrl({
|
||||
url: getAdrLocationDir(entity)!,
|
||||
url,
|
||||
base: getEntitySourceLocation(entity).target,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user