releaser/src/validate_pr.rs

19 lines
605 B
Rust
Raw Normal View History

2023-04-07 02:19:01 +02:00
pub async fn validate_pr(
owner: &str,
repo: &str,
pull_request_id: u32,
current_version: &str,
) -> eyre::Result<Option<String>> {
let base_url = &std::env::var("GITEA_BASE_URL").unwrap();
let token = &std::env::var("GITEA_ACCESS_TOKEN").unwrap();
let commit_titles =
crate::gitea::get_pull_request_commits(base_url, owner, repo, pull_request_id, token)
.await?;
match crate::semantic::get_most_significant_bump(&commit_titles) {
Some(bump) => Ok(Some(crate::semantic::bump_semver(current_version, bump)?)),
None => Ok(None),
}
}