{"record":{"id":"70d31864c106ebda","repo":"linera-io/linera-protocol","slug":"github-base-branch-is-not-set-this-must-be-run-fr","errorCode":null,"errorMessage":"GITHUB_BASE_BRANCH is not set! This must be run from within CI","messagePattern":"GITHUB_BASE_BRANCH is not set! This must be run from within CI","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-summary/src/github.rs","lineNumber":130,"sourceCode":"            (\n                commit_hash,\n                branch_name,\n                base,\n                pr_number.ok_or_else(|| anyhow!(\"pr_number is None\"))?,\n            )\n        } else {\n            let pr_string = env_pr_number.map_err(|_| {\n                anyhow!(\"GITHUB_PR_NUMBER is not set! This must be run from within CI\")\n            })?;\n            (\n                env_pr_commit_hash.map_err(|_| {\n                    anyhow!(\"GITHUB_PR_COMMIT_HASH is not set! This must be run from within CI\")\n                })?,\n                env_pr_branch.map_err(|_| {\n                    anyhow!(\"GITHUB_PR_BRANCH is not set! This must be run from within CI\")\n                })?,\n                env_base_branch.map_err(|_| {\n                    anyhow!(\"GITHUB_BASE_BRANCH is not set! This must be run from within CI\")\n                })?,\n                pr_string\n                    .parse()\n                    .map_err(|_| anyhow!(\"GITHUB_PR_NUMBER is not a valid number: {pr_string}\"))?,\n            )\n        };\n\n        Ok(Self {\n            repository: GithubRepository::from_env(is_local)?,\n            pr_commit_hash,\n            pr_branch,\n            base_branch,\n            pr_number,\n        })\n    }\n}\n\n/// A GitHub client bound to a PR context, used to query workflow runs/jobs and post comments.","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-summary/src/github.rs#L112-L148","documentation":"In CI mode, from_env reads GITHUB_BASE_BRANCH — the target branch of the pull request (usually main) — and fails when it is unset. The summary compares PR results against this base, so an unknown base branch makes the run ambiguous and the constructor refuses to continue.","triggerScenarios":"Running the tool in CI mode without GITHUB_BASE_BRANCH exported; workflows that map github.base_ref to a differently-named variable; local emulation missing one of the four required variables.","commonSituations":"Incomplete hand-maintained workflow env blocks; running the summary step in a reusable workflow that did not forward the variables; CI environments that strip GITHUB_-prefixed vars for security.","solutions":["Export the base branch in the workflow: GITHUB_BASE_BRANCH: ${{ github.base_ref }}","Or set it manually with the other three GITHUB_PR_*/BASE variables when running outside Actions","Grep the workflow env block for typos — the other three sibling variables fail with their own messages, so fix all that appear"],"exampleFix":"# before\nenv:\n  GITHUB_BASE: ${{ github.base_ref }}\n# after\nenv:\n  GITHUB_BASE_BRANCH: ${{ github.base_ref }}","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n: \"${GITHUB_BASE_BRANCH:?GITHUB_BASE_BRANCH is required (PR target branch)}\"","typeGuard":null,"tryCatchPattern":"if let Err(e) = Github::new(false, None) {\n    if e.to_string().contains(\"GITHUB_BASE_BRANCH\") {\n        eprintln!(\"export GITHUB_BASE_BRANCH=${{ github.base_ref }} in the workflow env\");\n    }\n    return Err(e.into());\n}","preventionTips":["Map github.base_ref to GITHUB_BASE_BRANCH in the workflow env block","Keep the full set of required GITHUB_* variables in one documented template","Validate env completeness at job start so failures happen before any GitHub API calls"],"tags":["linera","ci","github-actions","environment"],"backgroundTag":"missing-env-var","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}