Fetch more than 1 tag
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Aode (lion) 2021-12-18 20:32:30 -06:00
parent 872f20ed18
commit 73cb0c1eb7

View file

@ -217,14 +217,15 @@ async fn get_previous_revision(
config: &GiteaConfig,
) -> color_eyre::eyre::Result<Revision> {
let tags_url = format!(
"https://{}/api/v1/repos/{}/{}/tags?page=1&limit=1",
"https://{}/api/v1/repos/{}/{}/tags?page=1&limit=4",
config.domain, config.owner, config.repo
);
let tags_response = client.get(tags_url).send().await?;
let mut tags: Vec<GiteaTagResponse> = tags_response.json().await?;
let tags: Vec<GiteaTagResponse> = tags_response.json().await?;
let revision = if let Some(tag) = tags.pop() {
let revision = if let Some(tag) = tags.get(0) {
tracing::info!("tag: {}", tag.name);
tag.name.parse()?
} else {
Revision::default()
@ -292,6 +293,7 @@ async fn run() -> color_eyre::eyre::Result<()> {
let version_string = check_project(config.project).await?;
tracing::info!("Previous revision: {}", previous_revision);
let revision = previous_revision.next(version_string);
tracing::info!("New revision: {}", revision);