2021-03-05 02:36:52 +00:00
|
|
|
name: Get modified files
|
|
|
|
description: Get modified files
|
|
|
|
author: tj-actions
|
|
|
|
inputs:
|
2021-03-05 12:25:17 +00:00
|
|
|
separator:
|
|
|
|
description: 'Split character for array output'
|
2021-03-05 02:36:52 +00:00
|
|
|
required: true
|
2021-03-05 12:25:17 +00:00
|
|
|
default: " "
|
|
|
|
|
2021-03-05 03:43:17 +00:00
|
|
|
outputs:
|
|
|
|
added_files:
|
|
|
|
description: List of added files.
|
2021-03-05 11:03:04 +00:00
|
|
|
value: ${{ steps.changed-files.outputs.added_files }}
|
2021-03-05 03:43:17 +00:00
|
|
|
copied_files:
|
|
|
|
description: List of copied files.
|
2021-03-05 11:03:04 +00:00
|
|
|
value: ${{ steps.changed-files.outputs.copied_files }}
|
2021-03-05 03:43:17 +00:00
|
|
|
deleted_files:
|
|
|
|
description: List of deleted files.
|
2021-03-05 11:03:04 +00:00
|
|
|
value: ${{ steps.changed-files.outputs.deleted_files }}
|
2021-03-05 03:43:17 +00:00
|
|
|
modified_files:
|
2021-03-05 11:03:04 +00:00
|
|
|
description: List of modified files.
|
|
|
|
value: ${{ steps.changed-files.outputs.modified_files }}
|
2021-03-05 03:43:17 +00:00
|
|
|
renamed_files:
|
|
|
|
description: List of renamed files.
|
2021-03-05 11:03:04 +00:00
|
|
|
value: ${{ steps.changed-files.outputs.renamed_files }}
|
2021-03-05 03:43:17 +00:00
|
|
|
changed_files:
|
2021-03-05 11:03:04 +00:00
|
|
|
description: List of changed files.
|
|
|
|
value: ${{ steps.changed-files.outputs.changed_files }}
|
2021-03-05 03:43:17 +00:00
|
|
|
unmerged_files:
|
|
|
|
description: List of unmerged files.
|
2021-03-05 11:03:04 +00:00
|
|
|
value: ${{ steps.changed-files.outputs.unmerged_files }}
|
2021-03-05 03:43:17 +00:00
|
|
|
unknown_files:
|
|
|
|
description: List of unknown files.
|
2021-03-05 11:03:04 +00:00
|
|
|
value: ${{ steps.changed-files.outputs.unknown_files }}
|
2021-03-05 03:43:17 +00:00
|
|
|
all_changed_files:
|
|
|
|
description: List of all changed files.
|
2021-03-05 11:03:04 +00:00
|
|
|
value: ${{ steps.changed-files.outputs.all_changed_files }}
|
2021-03-05 02:36:52 +00:00
|
|
|
|
|
|
|
runs:
|
2021-03-05 03:50:33 +00:00
|
|
|
using: 'composite'
|
|
|
|
steps:
|
|
|
|
- id: changed-files
|
|
|
|
run: |
|
2021-03-05 10:55:53 +00:00
|
|
|
if [[ -z $GITHUB_BASE_REF ]]; then
|
|
|
|
echo "Skipping: This should only run on pull_request.";
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
|
|
|
|
TARGET_BRANCH=${GITHUB_BASE_REF}
|
|
|
|
CURRENT_BRANCH=${GITHUB_HEAD_REF}
|
|
|
|
|
|
|
|
git fetch --depth=1 origin ${TARGET_BRANCH}:${TARGET_BRANCH}
|
|
|
|
|
|
|
|
echo "Getting head sha..."
|
2021-03-05 11:25:28 +00:00
|
|
|
|
2021-03-05 10:55:53 +00:00
|
|
|
HEAD_SHA=$(git rev-parse ${TARGET_BRANCH} || true)
|
2021-03-05 12:13:15 +00:00
|
|
|
|
2021-03-11 00:36:33 +00:00
|
|
|
ADDED=$(git diff --diff-filter=A --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
|
|
|
COPIED=$(git diff --diff-filter=C --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
|
|
|
DELETED=$(git diff --diff-filter=D --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
|
|
|
MODIFIED=$(git diff --diff-filter=M --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
|
|
|
RENAMED=$(git diff --diff-filter=R --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
|
|
|
CHANGED=$(git diff --diff-filter=T --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
|
|
|
UNMERGED=$(git diff --diff-filter=U --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
|
|
|
UNKNOWN=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
|
|
|
ALL_CHANGED=$(git diff --diff-filter='*' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
2021-03-05 10:55:53 +00:00
|
|
|
|
|
|
|
echo "Getting diff..."
|
2021-03-05 12:13:15 +00:00
|
|
|
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"
|
2021-03-05 03:50:33 +00:00
|
|
|
shell: bash
|
2021-03-05 10:58:42 +00:00
|
|
|
|
2021-03-05 02:36:52 +00:00
|
|
|
branding:
|
|
|
|
icon: git-pull-request
|
|
|
|
color: white
|