* Append a key=value line to a GitHub Actions file (GITHUB_OUTPUT or GITHUB_ENV) * if the file path is set and the value is truthy. * @param {string | undefined} filePath - Path to the output/env file * @param {string} key - The variable name * @param {string} value - The value to write * @para
(filePath, key, value, logLabel, fileLabel)
| 39 | * @param {string} fileLabel - Human-readable file name for the log (e.g. "GITHUB_OUTPUT") |
| 40 | */ |
| 41 | function writeEnvLine(filePath, key, value, logLabel, fileLabel) { |
| 42 | if (!filePath || !value) return; |
| 43 | appendFileSync(filePath, `${key}=${value}\n`); |
| 44 | console.log(`[otlp] ${logLabel} written to ${fileLabel}`); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * @param {string} headers |