-
Notifications
You must be signed in to change notification settings - Fork 17
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
If the user does not specify the optional git_cli
input, we should respect any pre-existing value of the JULIA_PKG_USE_CLI_GIT
environment variable
#39
base: main
Are you sure you want to change the base?
Conversation
…respect any pre-existing value of the `JULIA_PKG_USE_CLI_GIT` environment variable
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #39 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 2 2
=========================================
Hits 2 2 ☔ View full report in Codecov by Sentry. |
INPUT_GIT_CLI_str = strip(ENV["INPUT_GIT_CLI"]) | ||
if isempty(INPUT_GIT_CLI_str) | ||
# Empty = user did not provide this input = we should do nothing. | ||
else | ||
# Non-empty = user provided this input = we enforce that it must be either | ||
# `true` or `false`. | ||
INPUT_GIT_CLI_b = parse(Bool, INPUT_GIT_CLI_str) | ||
ENV["JULIA_PKG_USE_CLI_GIT"] = "$(INPUT_GIT_CLI_b)" | ||
if (VERSION < v"1.7-") && INPUT_GIT_CLI_b | ||
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INPUT_GIT_CLI_str = strip(ENV["INPUT_GIT_CLI"]) | |
if isempty(INPUT_GIT_CLI_str) | |
# Empty = user did not provide this input = we should do nothing. | |
else | |
# Non-empty = user provided this input = we enforce that it must be either | |
# `true` or `false`. | |
INPUT_GIT_CLI_b = parse(Bool, INPUT_GIT_CLI_str) | |
ENV["JULIA_PKG_USE_CLI_GIT"] = "$(INPUT_GIT_CLI_b)" | |
if (VERSION < v"1.7-") && INPUT_GIT_CLI_b | |
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow) | |
end | |
git_cli = strip(ENV["INPUT_GIT_CLI"]) | |
if !isempty(git_cli) | |
ENV["JULIA_PKG_USE_CLI_GIT"] = string(git_cli == "true") | |
if VERSION < v"1.7-" && git_cli == "true" | |
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow) | |
end |
Alternatively, if we want to follow the original code's behavior where JULIA_PKG_USE_CLI_GIT
is only set in Julia 1.7- and above we can do:
INPUT_GIT_CLI_str = strip(ENV["INPUT_GIT_CLI"]) | |
if isempty(INPUT_GIT_CLI_str) | |
# Empty = user did not provide this input = we should do nothing. | |
else | |
# Non-empty = user provided this input = we enforce that it must be either | |
# `true` or `false`. | |
INPUT_GIT_CLI_b = parse(Bool, INPUT_GIT_CLI_str) | |
ENV["JULIA_PKG_USE_CLI_GIT"] = "$(INPUT_GIT_CLI_b)" | |
if (VERSION < v"1.7-") && INPUT_GIT_CLI_b | |
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow) | |
end | |
git_cli = strip(ENV["INPUT_GIT_CLI"]) | |
if VERSION >= v"1.7-" && !isempty(git_cli) | |
ENV["JULIA_PKG_USE_CLI_GIT"] = string(git_cli == "true") | |
elseif VERSION < v"1.7-" && git_cli == "true" | |
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow) | |
end |
#38 (comment)