Use GHEC-DR URL in Actions workflow run URL
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
getActionsWorkflowRunUrl as getVariantAnalysisActionsWorkflowRunUrl,
|
||||
} from "../variant-analysis/shared/variant-analysis";
|
||||
import type { QueryLanguage } from "../common/query-language";
|
||||
import { getGitHubInstanceUrl } from "../config";
|
||||
|
||||
export type QueryHistoryInfo = LocalQueryInfo | VariantAnalysisHistoryItem;
|
||||
|
||||
@@ -79,5 +80,8 @@ export function buildRepoLabel(item: VariantAnalysisHistoryItem): string {
|
||||
export function getActionsWorkflowRunUrl(
|
||||
item: VariantAnalysisHistoryItem,
|
||||
): string {
|
||||
return getVariantAnalysisActionsWorkflowRunUrl(item.variantAnalysis);
|
||||
return getVariantAnalysisActionsWorkflowRunUrl(
|
||||
item.variantAnalysis,
|
||||
getGitHubInstanceUrl(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -295,10 +295,14 @@ export function getSkippedRepoCount(
|
||||
|
||||
export function getActionsWorkflowRunUrl(
|
||||
variantAnalysis: VariantAnalysis,
|
||||
githubUrl: URL,
|
||||
): string {
|
||||
const {
|
||||
actionsWorkflowRunId,
|
||||
controllerRepo: { fullName },
|
||||
} = 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}`);
|
||||
}
|
||||
|
||||
const actionsWorkflowRunUrl = getActionsWorkflowRunUrl(variantAnalysis);
|
||||
const actionsWorkflowRunUrl = getActionsWorkflowRunUrl(
|
||||
variantAnalysis,
|
||||
this.config.githubUrl,
|
||||
);
|
||||
|
||||
await this.app.commands.execute(
|
||||
"vscode.open",
|
||||
|
||||
@@ -151,13 +151,29 @@ describe("isVariantAnalysisComplete", () => {
|
||||
});
|
||||
|
||||
describe("getActionsWorkflowRunUrl", () => {
|
||||
it("should get the run url", () => {
|
||||
it("should get the run url on github.com", () => {
|
||||
const variantAnalysis = createMockVariantAnalysis({});
|
||||
|
||||
const actionsWorkflowRunUrl = getActionsWorkflowRunUrl(variantAnalysis);
|
||||
const actionsWorkflowRunUrl = getActionsWorkflowRunUrl(
|
||||
variantAnalysis,
|
||||
new URL("https://github.com"),
|
||||
);
|
||||
|
||||
expect(actionsWorkflowRunUrl).toBe(
|
||||
`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