{"record":{"id":"43cf9cce1973240d","repo":"denoland/deno","slug":"github-run-id-environment-variable-is-not-set","errorCode":null,"errorMessage":"GITHUB_RUN_ID environment variable is not set","messagePattern":"GITHUB_RUN_ID environment variable is not set","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"cli/tools/publish/provenance.rs","lineNumber":190,"sourceCode":"    {\n      let (path, ref_) = rel_ref.split_at(delimn);\n      (path, &ref_[1..])\n    } else {\n      (rel_ref.as_str(), \"\")\n    };\n\n    let server_url = std::env::var(\"GITHUB_SERVER_URL\").map_err(|_| {\n      anyhow!(\"GITHUB_SERVER_URL environment variable is not set\")\n    })?;\n    let github_ref = std::env::var(\"GITHUB_REF\")\n      .map_err(|_| anyhow!(\"GITHUB_REF environment variable is not set\"))?;\n    let github_sha = std::env::var(\"GITHUB_SHA\")\n      .map_err(|_| anyhow!(\"GITHUB_SHA environment variable is not set\"))?;\n    let runner_env = std::env::var(\"RUNNER_ENVIRONMENT\").map_err(|_| {\n      anyhow!(\"RUNNER_ENVIRONMENT environment variable is not set\")\n    })?;\n    let run_id = std::env::var(\"GITHUB_RUN_ID\")\n      .map_err(|_| anyhow!(\"GITHUB_RUN_ID environment variable is not set\"))?;\n    let run_attempt = std::env::var(\"GITHUB_RUN_ATTEMPT\").map_err(|_| {\n      anyhow!(\"GITHUB_RUN_ATTEMPT environment variable is not set\")\n    })?;\n\n    Ok(Self {\n      build_definition: BuildDefinition {\n        build_type: GITHUB_BUILD_TYPE,\n        external_parameters: ExternalParameters {\n          workflow: GhaWorkflow {\n            ref_: workflow_ref.to_string(),\n            repository: format!(\"{}/{}\", server_url, &repo),\n            path: workflow_path.to_string(),\n          },\n        },\n        internal_parameters: InternalParameters {\n          github: GithubInternalParameters {\n            event_name: std::env::var(\"GITHUB_EVENT_NAME\").unwrap_or_default(),\n            repository_id: std::env::var(\"GITHUB_REPOSITORY_ID\")","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tools/publish/provenance.rs#L172-L208","documentation":"Provenance predicate construction reads `GITHUB_RUN_ID` (used for the run details) and throws this message when it is unset. As with the sibling variable checks, it always exists on genuine runners, so the error points to an environment that is missing parts of the Actions context.","triggerScenarios":"`deno publish --provenance` in a process where earlier variables were forwarded but GITHUB_RUN_ID was not.","commonSituations":"Selective env forwarding into containers; scripts that whitelist a few variables by hand.","solutions":["Forward GITHUB_RUN_ID together with the full runner environment","Run publish directly on the GitHub Actions runner","Drop `--provenance` outside GitHub Actions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if [ -z \"$GITHUB_RUN_ID\" ]; then\n  echo \"GITHUB_RUN_ID unset — publish --provenance needs the full Actions env\" >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Forward GITHUB_RUN_ID with the rest of the runner environment","Maintain one shared env-forwarding list in CI config instead of per-step copies","Run provenance publishes natively on the runner when possible"],"tags":["publish","provenance","github-actions","environment","sigstore"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}