{"record":{"id":"8b20c75b1291b970","repo":"linera-io/linera-protocol","slug":"github-repository-is-not-set-this-must-be-run-fro","errorCode":null,"errorMessage":"GITHUB_REPOSITORY is not set! This must be run from within CI","messagePattern":"GITHUB_REPOSITORY is not set! This must be run from within CI","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-summary/src/github.rs","lineNumber":45,"sourceCode":"\nimpl GithubRepository {\n    /// Returns the repository owner.\n    pub fn owner(&self) -> &str {\n        &self.owner\n    }\n\n    /// Returns the repository name.\n    pub fn name(&self) -> &str {\n        &self.name\n    }\n\n    fn from_env(is_local: bool) -> Result<Self> {\n        let env_repository = env::var(\"GITHUB_REPOSITORY\");\n        let repository = if is_local {\n            env_repository.unwrap_or_else(|_| \"linera-io/linera-protocol\".to_string())\n        } else {\n            env_repository.map_err(|_| {\n                anyhow!(\"GITHUB_REPOSITORY is not set! This must be run from within CI\")\n            })?\n        };\n        let parts = repository.split('/').collect::<Vec<_>>();\n        assert_eq!(parts.len(), 2);\n        let owner = parts[0].to_string();\n        let name = parts[1].to_string();\n        Ok(Self { owner, name })\n    }\n}\n\n/// The GitHub context for the PR being analyzed: repository, branches, commit and PR number.\npub struct GithubContext {\n    repository: GithubRepository,\n    pr_commit_hash: String,\n    pr_branch: String,\n    base_branch: String,\n    pr_number: u64,\n}","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-summary/src/github.rs#L27-L63","documentation":"GithubRepository::from_env in linera-summary resolves the target repository. In CI mode (is_local = false) it reads GITHUB_REPOSITORY — normally injected by GitHub Actions — and hard-fails when it is unset, since without it the tool cannot know which repo to query.","triggerScenarios":"Running linera-summary in non-local mode outside a GitHub Actions runner: bare `cargo run`, docker, cron. Any environment lacking GITHUB_REPOSITORY aborts before any API call.","commonSituations":"Testing the summary tool locally while forgetting the local-mode flag; moving a workflow step to a self-hosted script; CI runners that scrub environment variables.","solutions":["Run inside GitHub Actions, where GITHUB_REPOSITORY is set automatically (format 'owner/repo')","Or export it manually: GITHUB_REPOSITORY=owner/repo <command>","Or switch the tool to local mode, which falls back to linera-io/linera-protocol when the variable is missing"],"exampleFix":"# before\nGITHUB_PR_NUMBER=7 linera-summary ...\n# after\nGITHUB_REPOSITORY=linera-io/linera-protocol GITHUB_PR_NUMBER=7 linera-summary ...","handlingStrategy":"validation","validationCode":"// Rust: verify CI env before constructing\nfor var in [\"GITHUB_REPOSITORY\"] {\n    if std::env::var(var).is_err() {\n        anyhow::bail!(\"{var} is required in CI mode; export it or run with local mode\");\n    }\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = Github::new(false, None) {\n    if e.to_string().contains(\"GITHUB_REPOSITORY\") {\n        eprintln!(\"missing CI env; set GITHUB_REPOSITORY=owner/repo or use --local\");\n    }\n    return Err(e.into());\n}","preventionTips":["Gate CI-mode invocations on a quick env-var presence check","In local testing, use the local mode flag instead of hand-faking CI variables","Keep a checklist of required GITHUB_* variables next to workflow definitions"],"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"}