{"record":{"id":"54f1016512b336b1","repo":"denoland/deno","slug":"github-run-attempt-environment-variable-is-not-set","errorCode":null,"errorMessage":"GITHUB_RUN_ATTEMPT environment variable is not set","messagePattern":"GITHUB_RUN_ATTEMPT environment variable is not set","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"cli/tools/publish/provenance.rs","lineNumber":192,"sourceCode":"      (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\")\n              .unwrap_or_default(),\n            repository_owner_id: std::env::var(\"GITHUB_REPOSITORY_OWNER_ID\")","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tools/publish/provenance.rs#L174-L210","documentation":"The last of the required runner variables: provenance predicate construction reads `GITHUB_RUN_ATTEMPT` and throws this message when it is unset. Reaching this particular check means every earlier variable (GITHUB_REPOSITORY, GITHUB_SERVER_URL, GITHUB_REF, GITHUB_SHA, RUNNER_ENVIRONMENT, GITHUB_RUN_ID) was present — only this one is missing.","triggerScenarios":"`deno publish --provenance` where all other runner variables were forwarded but GITHUB_RUN_ATTEMPT was omitted.","commonSituations":"Hand-maintained env whitelists in wrappers that predate this variable being required; partial env snapshots in containers.","solutions":["Add GITHUB_RUN_ATTEMPT to the forwarded environment","Prefer forwarding the entire runner env instead of a hand-picked list","Drop `--provenance` outside GitHub Actions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if [ -z \"$GITHUB_RUN_ATTEMPT\" ]; then\n  echo \"GITHUB_RUN_ATTEMPT unset — publish --provenance needs the full Actions env\" >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Forward GITHUB_RUN_ATTEMPT (re-check your list after Deno upgrades — requirements grow over time)","Prefer forwarding the entire runner env over a static whitelist","Add a CI preflight that fails before the publish step if any required variable is missing"],"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"}