* Build a workflow run URL from the provided context and workflow repository. * * This is the canonical helper for constructing attribution run URLs in safe-output * handlers. It must always receive the **original** workflow repo (not an overridden * cross-repo effectiveContext) so that footer l
(ctx, workflowRepo)
| 32 | * @returns {string} The full workflow run URL |
| 33 | */ |
| 34 | function buildWorkflowRunUrl(ctx, workflowRepo) { |
| 35 | const server = ctx.serverUrl || process.env.GITHUB_SERVER_URL || "https://github.com"; |
| 36 | let { owner = "", repo = "" } = workflowRepo ?? {}; |
| 37 | if (!owner || !repo) { |
| 38 | // When context is spread (e.g. `{...context}`), prototype getters like context.repo |
| 39 | // are not included. Fall back to GITHUB_REPOSITORY for the workflow repo. |
| 40 | const [envOwner = "", envRepo = ""] = (process.env.GITHUB_REPOSITORY || "").split("/"); |
| 41 | if (envOwner && envRepo) { |
| 42 | owner = owner || envOwner; |
| 43 | repo = repo || envRepo; |
| 44 | } |
| 45 | } |
| 46 | return `${server}/${owner}/${repo}/actions/runs/${ctx.runId}`; |
| 47 | } |
| 48 | |
| 49 | module.exports = { |
| 50 | getWorkflowMetadata, |
no outgoing calls
no test coverage detected