We were in a situation where one of our runners would fallback to the GitHub REST API. Even though actions/checkout was able to find our locally installed git.
This made me rummage through the source code of the action and I noticed that all errors from creating/initializing the CommandManager will be ignored. Even though the errors themselves would have been very useful. For example, we were using sparse checkouts, and apparently the sparse checkout version requires git 2.28. If the errors would have been printen then this wouldn't have taken us a few hours to find out that the locally installed git version was outdated (2.23).
I would like to propose to add a simple print//info on the contents of the error message in the getGitCommandManager function's catch block.
} catch (err) {
// add this?
core.info(`Failed to initialize CommandManager: ${err.message}`)
// Git is required for LFS
if (settings.lfs) {
throw err
}
This would result in an info print like: Failed to initialize CommandManager: Minimum Git version required for sparse checkout is 2.28. Your git ('/path/to/git') is 2.23
Another option would be to also check settings.sparseCheckout. And if that setting is set, just like settings.lfs to rethrow err. As a valid git version is required for sparseCheckouts and the action is unable to do a sparse checkout when doing a download over the REST API.
We were in a situation where one of our runners would fallback to the GitHub REST API. Even though
actions/checkoutwas able to find our locally installed git.This made me rummage through the source code of the action and I noticed that all errors from creating/initializing the CommandManager will be ignored. Even though the errors themselves would have been very useful. For example, we were using sparse checkouts, and apparently the sparse checkout version requires git 2.28. If the errors would have been printen then this wouldn't have taken us a few hours to find out that the locally installed git version was outdated (2.23).
I would like to propose to add a simple print//info on the contents of the error message in the
getGitCommandManagerfunction's catch block.This would result in an info print like:
Failed to initialize CommandManager: Minimum Git version required for sparse checkout is 2.28. Your git ('/path/to/git') is 2.23Another option would be to also check
settings.sparseCheckout. And if that setting is set, just likesettings.lfsto rethrow err. As a valid git version is required for sparseCheckouts and the action is unable to do a sparse checkout when doing a download over the REST API.