Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/commands/build/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
.get_one("head_sha")
.map(String::as_str)
.map(Cow::Borrowed)
.or_else(|| vcs::find_head().ok().map(Cow::Owned));
.or_else(|| vcs::find_head_sha().ok().map(Cow::Owned));

let cached_remote = config.get_cached_vcs_remote();
// Try to open the git repository and find the remote, but handle errors gracefully.
Expand Down
3 changes: 2 additions & 1 deletion src/utils/releases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ pub fn detect_release_name() -> Result<String> {
}
}

match vcs::find_head() {
// finally try the git sha
match vcs::find_head_sha() {
Ok(head) => Ok(head),
Err(e) => Err(anyhow!(
"Could not automatically determine release name:\n\t {e} \n\n\
Expand Down
4 changes: 2 additions & 2 deletions src/utils/vcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ fn find_matching_revs(
Ok((prev_rev, rev))
}

pub fn find_head() -> Result<String> {
pub fn find_head_sha() -> Result<String> {
if let Some(pr_head_sha) = std::env::var("GITHUB_EVENT_PATH")
.ok()
.and_then(|event_path| std::fs::read_to_string(event_path).ok())
Expand Down Expand Up @@ -1678,7 +1678,7 @@ mod tests {
fs::write(&event_file, pr_json).expect("Failed to write event file");

std::env::set_var("GITHUB_EVENT_PATH", event_file.to_str().unwrap());
let result = find_head();
let result = find_head_sha();
std::env::remove_var("GITHUB_EVENT_PATH");

assert!(result.is_ok());
Expand Down