* Builds a workflow-call identifier for the current workflow invocation. * * GitHub reusable workflows share the same run ID as their caller, so the * workflow ref is appended when available to distinguish parent and child * workflow invocations inside a single run. * * @param {string | number
(runId, runAttempt, workflowRef)
| 103 | * @returns {string} |
| 104 | */ |
| 105 | function buildWorkflowCallId(runId, runAttempt, workflowRef) { |
| 106 | const normalizedRunId = String(runId ?? "").trim(); |
| 107 | if (!normalizedRunId) { |
| 108 | return ""; |
| 109 | } |
| 110 | |
| 111 | const normalizedRunAttempt = String(runAttempt ?? "").trim() || "1"; |
| 112 | const normalizedWorkflowRef = typeof workflowRef === "string" ? workflowRef.trim() : ""; |
| 113 | const baseId = `${normalizedRunId}-${normalizedRunAttempt}`; |
| 114 | |
| 115 | return normalizedWorkflowRef ? `${baseId}:${normalizedWorkflowRef}` : baseId; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * @param {unknown} value |
no outgoing calls
no test coverage detected