Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error parsing polkadot version from github API #142

Merged
merged 3 commits into from
May 9, 2024
Merged
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
26 changes: 16 additions & 10 deletions crates/pop-parachains/src/up.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,23 @@ impl Zombienet {

async fn latest_polkadot_release() -> Result<String, Error> {
let repo = Url::parse(POLKADOT_SDK).expect("repository url valid");
// Fetching latest releases
for release in GitHub::get_latest_releases(&repo).await? {
if !release.prerelease && release.tag_name.starts_with("polkadot-v") {
return Ok(release
.tag_name
.strip_prefix("polkadot-")
.map_or_else(|| release.tag_name.clone(), |v| v.to_string()));
}
match GitHub::get_latest_releases(&repo).await {
Ok(releases) => {
// Fetching latest releases
for release in releases {
if !release.prerelease && release.tag_name.starts_with("polkadot-v") {
return Ok(release
.tag_name
.strip_prefix("polkadot-")
.map_or_else(|| release.tag_name.clone(), |v| v.to_string()));
}
}
// It should never reach this point, but in case we download a default version of polkadot
Ok(POLKADOT_DEFAULT_VERSION.to_string())
},
// If an error with Github API return the POLKADOT DEFAULT VERSION
Err(_) => Ok(POLKADOT_DEFAULT_VERSION.to_string()),
}
// It should never reach this point, but in case we download a default version of polkadot
Ok(POLKADOT_DEFAULT_VERSION.to_string())
}
}

Expand Down
Loading