diff --git a/index.ts b/index.ts index b0ca0c9..d3acf3e 100644 --- a/index.ts +++ b/index.ts @@ -416,10 +416,11 @@ function useEnvModel() { function useEnvRunUrl() { const context = useContext() - const runId = process.env["GITHUB_RUN_ID"] - if (!runId) throw new Error(`Environment variable "GITHUB_RUN_ID" is not set`) + const runNumber = process.env["GITHUB_RUN_NUMBER"] || process.env["GITHUB_RUN_ID"] + if (!runNumber) throw new Error(`Environment variable "GITHUB_RUN_NUMBER" is not set`) - return `/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}` + const serverUrl = (process.env["GITHUB_SERVER_URL"] || "https://github.com").replace(/\/+$/, "") + return `${serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${runNumber}` } function useEnvAgent() {