From a04a801d0c93ddc0fbfeb9977a87f63f624c091d Mon Sep 17 00:00:00 2001 From: Ogheneobukome Ejaife Date: Tue, 30 Jun 2026 10:50:30 -0700 Subject: [PATCH 1/2] fix: support GitHub Enterprise Server domains in annotation URLs Replace hardcoded https://github.com in the deployment annotation runUri and getNormalizedPath blob links with GITHUB_SERVER_URL, falling back to https://github.com when the var is unset. This makes the generated links correct on GitHub Enterprise Server instances hosted on custom domains. --- src/utilities/githubUtils.ts | 3 ++- src/utilities/workflowAnnotationUtils.ts | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utilities/githubUtils.ts b/src/utilities/githubUtils.ts index 86b80eae1..2d0301539 100644 --- a/src/utilities/githubUtils.ts +++ b/src/utilities/githubUtils.ts @@ -44,7 +44,8 @@ export function normalizeWorkflowStrLabel(workflowName: string): string { export function getNormalizedPath(pathValue: string) { if (!isHttpUrl(pathValue)) { //if it is not an http url then convert to link from current repo and commit - return `https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${process.env.GITHUB_SHA}/${pathValue}` + const serverUrl = process.env.GITHUB_SERVER_URL || 'https://github.com' + return `${serverUrl}/${process.env.GITHUB_REPOSITORY}/blob/${process.env.GITHUB_SHA}/${pathValue}` } return pathValue } diff --git a/src/utilities/workflowAnnotationUtils.ts b/src/utilities/workflowAnnotationUtils.ts index b4ff55080..5e5114be5 100644 --- a/src/utilities/workflowAnnotationUtils.ts +++ b/src/utilities/workflowAnnotationUtils.ts @@ -16,7 +16,11 @@ export function getWorkflowAnnotations( workflowFileName: workflowFilePath.replace('.github/workflows/', ''), jobName: process.env.GITHUB_JOB, createdBy: process.env.GITHUB_ACTOR, - runUri: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`, + runUri: `${ + process.env.GITHUB_SERVER_URL || 'https://github.com' + }/${process.env.GITHUB_REPOSITORY}/actions/runs/${ + process.env.GITHUB_RUN_ID + }`, commit: process.env.GITHUB_SHA, lastSuccessRunCommit: lastSuccessRunSha, branch: process.env.GITHUB_REF, From 4ed2c385ad4ea7b41bf5f8536d6eb55699578ba7 Mon Sep 17 00:00:00 2001 From: Ogheneobukome Ejaife Date: Wed, 15 Jul 2026 12:59:32 -0700 Subject: [PATCH 2/2] refactor: extract runUri const and add custom server URL test Extract the inline runUri template literal in getWorkflowAnnotations into a named const for readability. Add a getNormalizedPath test covering the custom GITHUB_SERVER_URL (GitHub Enterprise) branch. --- src/utilities/githubUtils.test.ts | 15 +++++++++++++++ src/utilities/workflowAnnotationUtils.ts | 8 +++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/utilities/githubUtils.test.ts b/src/utilities/githubUtils.test.ts index 9d834e810..6f5ff0af7 100644 --- a/src/utilities/githubUtils.test.ts +++ b/src/utilities/githubUtils.test.ts @@ -36,6 +36,21 @@ describe('Github utils', () => { ) }) + it('normalizes path with a custom server url', () => { + const serverUrl = 'https://github.enterprise.com' + const repo = 'gh_repo' + const sha = 'gh_sha' + const path = 'path' + process.env.GITHUB_SERVER_URL = serverUrl + process.env.GITHUB_REPOSITORY = repo + process.env.GITHUB_SHA = sha + expect(getNormalizedPath(path)).toBe( + `${serverUrl}/${repo}/blob/${sha}/${path}` + ) + + delete process.env.GITHUB_SERVER_URL + }) + it('checks if url is http', () => { expect(isHttpUrl('www.test.com')).toBe(false) expect(isHttpUrl('http.test.com')).toBe(false) diff --git a/src/utilities/workflowAnnotationUtils.ts b/src/utilities/workflowAnnotationUtils.ts index 5e5114be5..a2a5a9528 100644 --- a/src/utilities/workflowAnnotationUtils.ts +++ b/src/utilities/workflowAnnotationUtils.ts @@ -9,6 +9,8 @@ export function getWorkflowAnnotations( workflowFilePath: string, deploymentConfig: DeploymentConfig ): string { + const serverUrl = process.env.GITHUB_SERVER_URL || 'https://github.com' + const runUri = `${serverUrl}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}` const annotationObject = { run: process.env.GITHUB_RUN_ID, repository: process.env.GITHUB_REPOSITORY, @@ -16,11 +18,7 @@ export function getWorkflowAnnotations( workflowFileName: workflowFilePath.replace('.github/workflows/', ''), jobName: process.env.GITHUB_JOB, createdBy: process.env.GITHUB_ACTOR, - runUri: `${ - process.env.GITHUB_SERVER_URL || 'https://github.com' - }/${process.env.GITHUB_REPOSITORY}/actions/runs/${ - process.env.GITHUB_RUN_ID - }`, + runUri, commit: process.env.GITHUB_SHA, lastSuccessRunCommit: lastSuccessRunSha, branch: process.env.GITHUB_REF,