Use GHEC-DR URL in Actions workflow run URL
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
|||||||
getActionsWorkflowRunUrl as getVariantAnalysisActionsWorkflowRunUrl,
|
getActionsWorkflowRunUrl as getVariantAnalysisActionsWorkflowRunUrl,
|
||||||
} from "../variant-analysis/shared/variant-analysis";
|
} from "../variant-analysis/shared/variant-analysis";
|
||||||
import type { QueryLanguage } from "../common/query-language";
|
import type { QueryLanguage } from "../common/query-language";
|
||||||
|
import { getGitHubInstanceUrl } from "../config";
|
||||||
|
|
||||||
export type QueryHistoryInfo = LocalQueryInfo | VariantAnalysisHistoryItem;
|
export type QueryHistoryInfo = LocalQueryInfo | VariantAnalysisHistoryItem;
|
||||||
|
|
||||||
@@ -79,5 +80,8 @@ export function buildRepoLabel(item: VariantAnalysisHistoryItem): string {
|
|||||||
export function getActionsWorkflowRunUrl(
|
export function getActionsWorkflowRunUrl(
|
||||||
item: VariantAnalysisHistoryItem,
|
item: VariantAnalysisHistoryItem,
|
||||||
): string {
|
): string {
|
||||||
return getVariantAnalysisActionsWorkflowRunUrl(item.variantAnalysis);
|
return getVariantAnalysisActionsWorkflowRunUrl(
|
||||||
|
item.variantAnalysis,
|
||||||
|
getGitHubInstanceUrl(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,10 +295,14 @@ export function getSkippedRepoCount(
|
|||||||
|
|
||||||
export function getActionsWorkflowRunUrl(
|
export function getActionsWorkflowRunUrl(
|
||||||
variantAnalysis: VariantAnalysis,
|
variantAnalysis: VariantAnalysis,
|
||||||
|
githubUrl: URL,
|
||||||
): string {
|
): string {
|
||||||
const {
|
const {
|
||||||
actionsWorkflowRunId,
|
actionsWorkflowRunId,
|
||||||
controllerRepo: { fullName },
|
controllerRepo: { fullName },
|
||||||
} = variantAnalysis;
|
} = variantAnalysis;
|
||||||
return `https://github.com/${fullName}/actions/runs/${actionsWorkflowRunId}`;
|
return new URL(
|
||||||
|
`/${fullName}/actions/runs/${actionsWorkflowRunId}`,
|
||||||
|
githubUrl,
|
||||||
|
).toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -956,7 +956,10 @@ export class VariantAnalysisManager
|
|||||||
throw new Error(`No variant analysis with id: ${variantAnalysisId}`);
|
throw new Error(`No variant analysis with id: ${variantAnalysisId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const actionsWorkflowRunUrl = getActionsWorkflowRunUrl(variantAnalysis);
|
const actionsWorkflowRunUrl = getActionsWorkflowRunUrl(
|
||||||
|
variantAnalysis,
|
||||||
|
this.config.githubUrl,
|
||||||
|
);
|
||||||
|
|
||||||
await this.app.commands.execute(
|
await this.app.commands.execute(
|
||||||
"vscode.open",
|
"vscode.open",
|
||||||
|
|||||||
@@ -151,13 +151,29 @@ describe("isVariantAnalysisComplete", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("getActionsWorkflowRunUrl", () => {
|
describe("getActionsWorkflowRunUrl", () => {
|
||||||
it("should get the run url", () => {
|
it("should get the run url on github.com", () => {
|
||||||
const variantAnalysis = createMockVariantAnalysis({});
|
const variantAnalysis = createMockVariantAnalysis({});
|
||||||
|
|
||||||
const actionsWorkflowRunUrl = getActionsWorkflowRunUrl(variantAnalysis);
|
const actionsWorkflowRunUrl = getActionsWorkflowRunUrl(
|
||||||
|
variantAnalysis,
|
||||||
|
new URL("https://github.com"),
|
||||||
|
);
|
||||||
|
|
||||||
expect(actionsWorkflowRunUrl).toBe(
|
expect(actionsWorkflowRunUrl).toBe(
|
||||||
`https://github.com/${variantAnalysis.controllerRepo.fullName}/actions/runs/${variantAnalysis.actionsWorkflowRunId}`,
|
`https://github.com/${variantAnalysis.controllerRepo.fullName}/actions/runs/${variantAnalysis.actionsWorkflowRunId}`,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should get the run url on GHEC-DR", () => {
|
||||||
|
const variantAnalysis = createMockVariantAnalysis({});
|
||||||
|
|
||||||
|
const actionsWorkflowRunUrl = getActionsWorkflowRunUrl(
|
||||||
|
variantAnalysis,
|
||||||
|
new URL("https://tenant.ghe.com"),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(actionsWorkflowRunUrl).toBe(
|
||||||
|
`https://tenant.ghe.com/${variantAnalysis.controllerRepo.fullName}/actions/runs/${variantAnalysis.actionsWorkflowRunId}`,
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user