Skip to content

Commit

Permalink
docs: suggest setting fetch-depth on ref errors
Browse files Browse the repository at this point in the history
Emit a hopefully more helpful error message when the Git ref doesn't
exist. The error message is the same we use when getting changed files
only: it suggests checking that repository clone is not shallow, and
that the full history is available. Additionally, when running on
GitHub Actions, it also suggests checking the fetch-depth option of the
actions/checkout step.

Fix #5315
  • Loading branch information
ferrarimarco committed Feb 22, 2024
1 parent 0f91a56 commit 0e44abb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/functions/buildFileList.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function IssueHintForFullGitHistory() {
info "See https://github.com/super-linter/super-linter#get-started"
info "Is shallow repository: $(git -C "${GITHUB_WORKSPACE}" rev-parse --is-shallow-repository)"
}
export -f IssueHintForFullGitHistory

function GenerateFileDiff() {
local DIFF_GIT_DEFAULT_BRANCH_CMD
Expand Down
1 change: 1 addition & 0 deletions lib/functions/validation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ function ValidateGitShaReference() {

debug "Validate that the GITHUB_SHA reference (${GITHUB_SHA}) exists in this Git repository."
if ! CheckIfGitRefExists "${GITHUB_SHA}"; then
IssueHintForFullGitHistory
fatal "The GITHUB_SHA reference (${GITHUB_SHA}) doesn't exist in this Git repository"
else
debug "The GITHUB_SHA reference (${GITHUB_SHA}) exists in this repository"
Expand Down

0 comments on commit 0e44abb

Please sign in to comment.