Skip to content

Commit

Permalink
Safe guarding versions that come in from github API #248
Browse files Browse the repository at this point in the history
  • Loading branch information
fontikar committed Dec 20, 2024
1 parent 7295616 commit 656b65e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R/load_taxonomic_resources.R
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,13 @@ default_version <- function() {
# Pull out versions
versions <- unique(release_data$tag_name)

# Exclude Taxonomy: first upload
dplyr::first(versions)
# Exclude rough semantic versions
cleaned_versions <- versions[!grepl("^\\d+\\.\\d+\\.\\d+(\\.\\d+)?$", versions)]

# Verify only dates left
if(all(grepl("^\\d{4}-\\d{2}-\\d{2}$", cleaned_versions)))
sort(cleaned_versions, decreasing = TRUE) |> #Sort from most recent to oldest
dplyr::first() # and take the first value after sorting
}
}

Expand Down

0 comments on commit 656b65e

Please sign in to comment.