Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@maelle

Description

@maelle

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions