Skip to content

Commit 710b5ee

Browse files
committed
ref(vcs): Make extract_pr_base_sha_from_event like extract_pr_head_sha_from_event
1 parent 0a539c6 commit 710b5ee

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/utils/vcs.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ pub fn find_base_sha() -> Result<Option<String>> {
575575
.and_then(|event_path| std::fs::read_to_string(event_path).map_err(Error::from))
576576
.context("Failed to read GitHub event path")?;
577577

578-
extract_pr_base_sha_from_event(&github_event)
578+
Ok(extract_pr_base_sha_from_event(&github_event))
579579
}
580580

581581
/// Extracts the PR head SHA from GitHub Actions event payload JSON.
@@ -595,9 +595,8 @@ fn extract_pr_head_sha_from_event(json_content: &str) -> Option<String> {
595595
}
596596

597597
/// Extracts the PR base SHA from GitHub Actions event payload JSON.
598-
/// Returns Ok(None) if not a PR event or if SHA cannot be extracted.
599-
/// Returns an error if we cannot parse the JSON.
600-
fn extract_pr_base_sha_from_event(json_content: &str) -> Result<Option<String>> {
598+
/// Returns None if not a PR event or if SHA cannot be extracted.
599+
fn extract_pr_base_sha_from_event(json_content: &str) -><Option<String> {
601600
let v: Value = serde_json::from_str(json_content)
602601
.context("Failed to parse GitHub event payload as JSON")?;
603602

@@ -1734,7 +1733,7 @@ mod tests {
17341733
}"#;
17351734

17361735
assert_eq!(
1737-
extract_pr_base_sha_from_event(incomplete_json).unwrap(),
1736+
extract_pr_base_sha_from_event(incomplete_json),
17381737
None
17391738
);
17401739
}

0 commit comments

Comments
 (0)