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

The latest release of r-lib/actions "broke" use_github_action() #1967

Closed
maelle opened this issue Mar 26, 2024 · 5 comments
Closed

The latest release of r-lib/actions "broke" use_github_action() #1967

maelle opened this issue Mar 26, 2024 · 5 comments

Comments

@maelle
Copy link
Contributor

maelle commented Mar 26, 2024

Reported by @SunnyTseng 🙏

Error we observe, with the backtrace hinting at pick_tag() being the problem:

> usethis::use_github_action()
Which action do you want to add? (0 to exit)
(See <https://github.com/r-lib/actions/tree/v2/examples> for other options) 

1: check-standard: Run `R CMD check` on Linux, macOS, and Windows
2: test-coverage: Compute test coverage and report to https://about.codecov.io
3: pr-commands: Add /document and /style commands for pull requests

Selection: 1
Error: invalid version specification ‘’
Backtrace:
 1. usethis::use_github_action()
 3. usethis:::latest_release()
 4. usethis:::pick_tag(tag_names)
 5. base::numeric_version(sub("^[^0-9]*", "", dat$nm))
 6. base::.make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version)

use_github_action() finds the ref part of the URL to the workflow by picking the latest release of the r-lib/actions repository.

ref <- ref %||% latest_release()

In latest_release(), the release names are extracted via GitHub API:

usethis/R/github-actions.R

Lines 260 to 270 in 9e64daf

raw_releases <- gh::gh(
"/repos/{owner}/{repo}/releases",
owner = spec_owner(parsed$repo_spec),
repo = spec_repo(parsed$repo_spec),
.api_url = parsed$host,
.limit = Inf
)
tag_names <- purrr::discard(
map_chr(raw_releases, "tag_name"),
map_lgl(raw_releases, "prerelease")
)

Today these names are c("v2", "sysreqs", "v1"). (Yesterday there was a new release of the r-lib/actions repo called "sysreqs". https://github.com/r-lib/actions/releases)

In pick_tag(), the line below transforms each of the names to a numeric version

dat$version <- numeric_version(sub("^[^0-9]*", "", dat$nm))

With "sysreqs", it doesn't work:

numeric_version(sub("^[^0-9]*", "", "sysreqs"))
#> Error: invalid version specification ''

Created on 2024-03-26 with reprex v2.1.0

@maelle
Copy link
Contributor Author

maelle commented Mar 26, 2024

@gaborcsardi would it work to simply add a "0" at the end of the "sysreqs" release name? 😅

numeric_version(sub("^[^0-9]*", "", "sysreqs0"))
#> [1] '0'

Created on 2024-03-26 with reprex v2.1.0

@maelle
Copy link
Contributor Author

maelle commented Mar 26, 2024

In the meantime, a workaround is to manually add the ref to the usethis_github_action() call:

use_github_action(ref = "v2")

@gaborcsardi
Copy link
Member

I'll delete the sysreqs tag in ~30 minutes, to give a chance to the currently running workflows to finish the setup-r step. After that this should be fixed.

@maelle
Copy link
Contributor Author

maelle commented Mar 26, 2024

Thank you!!

@gaborcsardi
Copy link
Member

OK, deleted the tag, windows setup-r still works, all seem to be good. Thanks for the report and the investigation. It made the fix really easy on my part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants