Fix commit branch when not in pull request
This commit is contained in:
parent
237e97f033
commit
2d99d4bee1
|
|
@ -17,9 +17,8 @@ fn main() {
|
|||
// They are accessed with the `env!("...")` macro in the codebase.
|
||||
println!("cargo:rustc-env=GRAPHITE_GIT_COMMIT_DATE={}", git_command(&["log", "-1", "--format=%cd"]));
|
||||
println!("cargo:rustc-env=GRAPHITE_GIT_COMMIT_HASH={}", git_command(&["rev-parse", "HEAD"]));
|
||||
println!(
|
||||
"cargo:rustc-env=GRAPHITE_GIT_COMMIT_BRANCH={}",
|
||||
std::env::var("GITHUB_HEAD_REF").unwrap_or_else(|_| git_command(&["name-rev", "--name-only", "HEAD"]))
|
||||
);
|
||||
let branch = std::env::var("GITHUB_HEAD_REF").unwrap_or_default();
|
||||
let branch = if branch.is_empty() { git_command(&["name-rev", "--name-only", "HEAD"]) } else { branch };
|
||||
println!("cargo:rustc-env=GRAPHITE_GIT_COMMIT_BRANCH={}", branch);
|
||||
println!("cargo:rustc-env=GRAPHITE_RELEASE_SERIES={}", GRAPHITE_RELEASE_SERIES);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue