Skip to content

Commit

Permalink
Update action.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed May 1, 2021
1 parent 4324557 commit 085386c
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions action.yml
Expand Up @@ -86,32 +86,44 @@ runs:
else
ADDED_FILES=()
COPIED_FILES=()
DELETED_FILES=()
MODIFIED_FILES=()
RENAMED_FILES=()
CHANGED_FILES=()
UNMERGED_FILES=()
UNKNOWN_FILES=()
ALL_CHANGED=()
ALL_MODIFIED_FILES=()
for path in ${INPUT_FILES}
do
echo "Checking for file changes: \"${path}\"..."
MODIFIED_FILE=$(git diff --diff-filter=ACMUXTR --name-only | grep -E "(${path})" || true)
echo "Checking for file changes: \"${path}\"..."
if [[ -z $MODIFIED_FILE ]]; then
# Find unstaged changes
MODIFIED_FILE=$(git status --porcelain | awk '{ print $2 }' | grep -E "(${path})" || true)
fi
ADDED_FILES+=$(git diff --diff-filter=A --name-only "$HEAD_SHA" | grep -E "(${path})")
COPIED_FILES+=$(git diff --diff-filter=C --name-only "$HEAD_SHA" | grep -E "(${path})")
DELETED_FILES+=$(git diff --diff-filter=D --name-only "$HEAD_SHA" | grep -E "(${path})")
MODIFIED_FILES+=$(git diff --diff-filter=M --name-only "$HEAD_SHA" | grep -E "(${path})")
RENAMED_FILES+=$(git diff --diff-filter=R --name-only "$HEAD_SHA" | grep -E "(${path})")
CHANGED_FILES+=$(git diff --diff-filter=T --name-only "$HEAD_SHA" | grep -E "(${path})")
UNMERGED_FILES+=$(git diff --diff-filter=U --name-only "$HEAD_SHA" | grep -E "(${path})")
UNKNOWN_FILES+=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | grep -E "(${path})")
ALL_CHANGED+=$(git diff --diff-filter='*ACDMRTUX' --name-only "$HEAD_SHA" | grep -E "(${path})")
ALL_MODIFIED_FILES+=$(git diff --diff-filter='ACM' --name-only "$HEAD_SHA" | grep -E "(${path})")
if [[ -n ${MODIFIED_FILE} ]]; then
echo "Found uncommited changes at: ${path}"
CHANGED_FILES+=("${path}")
fi
done
if [[ -z ${CHANGED_FILES} ]]; then
echo "::set-output name=files_changed::false"
else
echo "::set-output name=files_changed::true"
echo "::set-output name=changed_files::${CHANGED_FILES}"
fi
echo "::set-output name=added_files::$ADDED"
echo "::set-output name=copied_files::$COPIED"
echo "::set-output name=deleted_files::$DELETED"
echo "::set-output name=modified_files::$MODIFIED"
echo "::set-output name=renamed_files::$RENAMED"
echo "::set-output name=changed_files::$CHANGED"
echo "::set-output name=unmerged_files::$UNMERGED"
echo "::set-output name=unknown_files::$UNKNOWN"
echo "::set-output name=all_changed_files::$ALL_CHANGED"
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
fi
shell: bash

branding:
Expand Down

0 comments on commit 085386c

Please sign in to comment.