mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 04:32:16 -05:00
Allow ansible-lint with git diffs (#1554)
* Allow ansible-lint with git diffs super-linter checks the path of the file in lib/functions/detectFiles.sh to determine whether the file is an ansible playbook. When VALIDATE_ALL_CODEBASE=true, a list of absolute paths is generated which matches the expected path but when VALIDATE_ALL_CODEBASE=false, a list of relative paths is generated so no files are "detected" as ansible playbooks. This change outputs everything as an absolute path so diffs will also work. * fix quotes * Include eval to interpret pipe in cmd substitution * more quotes Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
This commit is contained in:
parent
5a91fddf5d
commit
3dc85fc3bc
1 changed files with 4 additions and 4 deletions
|
@ -20,7 +20,7 @@ function GenerateFileDiff() {
|
|||
#################################################
|
||||
# Get the Array of files changed in the commits #
|
||||
#################################################
|
||||
CMD_OUTPUT=$($CMD)
|
||||
CMD_OUTPUT=$(eval "$CMD")
|
||||
|
||||
#######################
|
||||
# Load the error code #
|
||||
|
@ -100,7 +100,7 @@ function BuildFileList() {
|
|||
################
|
||||
# push event #
|
||||
################
|
||||
DIFF_TREE_CMD="git -C ${GITHUB_WORKSPACE} diff-tree --no-commit-id --name-only -r ${GITHUB_SHA}"
|
||||
DIFF_TREE_CMD="git -C ${GITHUB_WORKSPACE} diff-tree --no-commit-id --name-only -r ${GITHUB_SHA} | xargs -I % sh -c 'echo \"${GITHUB_WORKSPACE}/%\"' 2>&1"
|
||||
GenerateFileDiff "$DIFF_TREE_CMD"
|
||||
|
||||
###############################################################
|
||||
|
@ -114,7 +114,7 @@ function BuildFileList() {
|
|||
debug "----------------------------------------------"
|
||||
debug "WARN: Generation of File array with diff-tree produced [0] items, trying with git diff..."
|
||||
|
||||
DIFF_CMD="git -C ${GITHUB_WORKSPACE} diff --name-only ${DEFAULT_BRANCH}...${GITHUB_SHA} --diff-filter=d"
|
||||
DIFF_CMD="git -C ${GITHUB_WORKSPACE} diff --name-only ${DEFAULT_BRANCH}...${GITHUB_SHA} --diff-filter=d | xargs -I % sh -c 'echo \"${GITHUB_WORKSPACE}/%\"' 2>&1"
|
||||
GenerateFileDiff "$DIFF_CMD"
|
||||
|
||||
fi
|
||||
|
@ -122,7 +122,7 @@ function BuildFileList() {
|
|||
################
|
||||
# PR event #
|
||||
################
|
||||
DIFF_CMD="git -C ${GITHUB_WORKSPACE} diff --name-only ${DEFAULT_BRANCH}...${GITHUB_SHA} --diff-filter=d"
|
||||
DIFF_CMD="git -C ${GITHUB_WORKSPACE} diff --name-only ${DEFAULT_BRANCH}...${GITHUB_SHA} --diff-filter=d | xargs -I % sh -c 'echo \"${GITHUB_WORKSPACE}/%\"' 2>&1"
|
||||
GenerateFileDiff "$DIFF_CMD"
|
||||
fi
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue