如何在 google 云平台上使用 usethis 来增加我的 R 包的版本?

How can I use usethis to increase version of my R package on google cloud platform?

我正在尝试在 google 云平台上增加我的包版本和 R 会话。我想我一定遗漏了一些东西,因为我认为当设置 which 时,代码应该能够 运行 而无需进一步的用户输入。

rlang::is_interactive() returns FALSE 如我所料。

usethis::use_version(which = "minor")
✔ Setting active project to '/home/jupyter/x/y'

Error: User input required, but session is not interactive.
Query: There are uncommitted changes and you're about to bump version
Do you want to proceed anyway?
Traceback:

1. usethis::use_version("minor")
2. challenge_uncommitted_changes(msg = "There are uncommitted changes and you're about to bump version")
3. ui_yeah("{msg}\nDo you want to proceed anyway?")
4. ui_stop(c("User input required, but session is not interactive.", 
 .     "Query: {x}"))

函数代码如下:https://github.com/r-lib/usethis/blob/master/R/version.R

function (which = NULL) 
{
    if (is.null(which) && !is_interactive()) {
        return(invisible(FALSE))
    }
    check_is_package("use_version()")
    challenge_uncommitted_changes(msg = "There are uncommitted changes and you're about to bump version")
    new_ver <- choose_version("What should the new version be?", 
        which)
    if (is.null(new_ver)) {
        return(invisible(FALSE))
    }
    use_description_field("Version", new_ver, overwrite = TRUE)
    if (names(new_ver) == "dev") {
        use_news_heading("(development version)")
    }
    else {
        use_news_heading(new_ver)
    }
    use_c_version(new_ver)
    git_ask_commit("Increment version number", untracked = TRUE, 
        paths = c("DESCRIPTION", "NEWS.md", path("src", "version.c")))
    invisible(TRUE)
}

这可能是 choose_version() 中的错误吗?

R 版

platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          6.3                         
year           2020                        
month          02                          
day            29                          
svn rev        77875                       
language       R                           
version.string R version 3.6.3 (2020-02-29)
nickname       Holding the Windsock  

此问题是由存储库中未提交的更改引起的,这触发了 use_version 中的交互行为。

具体在challenge_uncommitted_changes(msg = "There are uncommitted changes and you're about to bump version").

这导致返回错误消息。

我通过提交所有 untracked/modified 个文件解决了这个问题。

我已将此标记给软件包维护者,因为我认为有必要让函数 运行 非交互地运行,而无需提交更改。

感谢 @MrFlick 关于如何解决此问题的正确建议。