Merge pull request #23007 from deepan10/adr-issue-22102

Fixed: ADR file path in Azure DevOps
This commit is contained in:
Ben Lambert
2024-02-26 16:40:53 +01:00
committed by GitHub
4 changed files with 17 additions and 4 deletions
+1
View File
@@ -25,6 +25,7 @@ export const ANNOTATION_ADR_LOCATION = 'backstage.io/adr-location';
export const getAdrLocationUrl: (
entity: Entity,
scmIntegration: ScmIntegrationRegistry,
adrFilePath?: String,
) => string;
// @public
+8 -1
View File
@@ -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,
});
};