Skip to content

Commit f38edba

Browse files
Rename GitHub workflow run ID parser
1 parent 8da79d8 commit f38edba

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

tools/release/src/targets/github_release.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,15 @@ impl GithubRelease {
5858
cmd.read()
5959
.map(|s| s.trim().to_owned())
6060
.map_err(|e| format!("Failed to execute dispatch attach-artifacts.yml: {e}"))
61-
.and_then(|output| Self::run_id_from_output(&output).map(str::to_owned))
61+
.and_then(|url| Self::run_id_from_url(&url).map(str::to_owned))
6262
}
6363

64-
fn run_id_from_output(output: &str) -> Result<&str, String> {
65-
let url = output
66-
.split_whitespace()
67-
.find(|word| word.starts_with("https://") && word.contains("/actions/runs/"))
68-
.unwrap_or(output);
69-
64+
fn run_id_from_url(url: &str) -> Result<&str, String> {
7065
url.trim_end_matches('/')
7166
.rsplit('/')
7267
.next()
7368
.filter(|segment| !segment.is_empty() && segment.chars().all(|ch| ch.is_ascii_digit()))
74-
.ok_or_else(|| {
75-
format!(
76-
"Could not parse workflow run id from gh workflow run output: {}",
77-
output
78-
)
79-
})
69+
.ok_or_else(|| format!("Could not parse workflow run id from URL: {}", url))
8070
}
8171

8272
fn wait_for_workflow(&self, run_id: &str) -> Result<(), String> {

0 commit comments

Comments
 (0)