mirror of
https://github.com/tj-actions/changed-files
synced 2025-01-05 09:35:54 +00:00
Update action.yml
This commit is contained in:
parent
e40a576638
commit
19674b1082
1 changed files with 28 additions and 1 deletions
29
action.yml
29
action.yml
|
@ -32,7 +32,34 @@ runs:
|
||||||
steps:
|
steps:
|
||||||
- id: changed-files
|
- id: changed-files
|
||||||
run: |
|
run: |
|
||||||
bash entrypoint.sh
|
if [[ -z $GITHUB_BASE_REF ]]; then
|
||||||
|
echo "Skipping: This should only run on pull_request.";
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
GITHUB_TOKEN=$1
|
||||||
|
TARGET_BRANCH=${GITHUB_BASE_REF}
|
||||||
|
CURRENT_BRANCH=${GITHUB_HEAD_REF}
|
||||||
|
|
||||||
|
echo "Getting base branch..."
|
||||||
|
git config --local remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||||
|
git config --local --add remote.origin.fetch "+refs/tags/*:refs/tags/*"
|
||||||
|
|
||||||
|
git fetch --depth=1 origin ${TARGET_BRANCH}:${TARGET_BRANCH}
|
||||||
|
|
||||||
|
echo "Getting head sha..."
|
||||||
|
HEAD_SHA=$(git rev-parse ${TARGET_BRANCH} || true)
|
||||||
|
|
||||||
|
echo "Getting diff..."
|
||||||
|
echo "::set-output name=added_files::$(git diff --diff-filter=A --name-only ${HEAD_SHA} || true)"
|
||||||
|
echo "::set-output name=copied_files::$(git diff --diff-filter=C --name-only ${HEAD_SHA} || true)"
|
||||||
|
echo "::set-output name=deleted_files::$(git diff --diff-filter=D --name-only ${HEAD_SHA} || true)"
|
||||||
|
echo "::set-output name=modified_files::$(git diff --diff-filter=M --name-only ${HEAD_SHA} || true)"
|
||||||
|
echo "::set-output name=renamed_files::$(git diff --diff-filter=R --name-only ${HEAD_SHA} || true)"
|
||||||
|
echo "::set-output name=changed_files::$(git diff --diff-filter=T --name-only ${HEAD_SHA} || true)"
|
||||||
|
echo "::set-output name=unmerged_files::$(git diff --diff-filter=R --name-only ${HEAD_SHA} || true)"
|
||||||
|
echo "::set-output name=unknown_files::$(git diff --diff-filter=X --name-only ${HEAD_SHA} || true)"
|
||||||
|
echo "::set-output name=all_changed_files::$(git diff --diff-filter="*" --name-only ${HEAD_SHA} || true)"
|
||||||
shell: bash
|
shell: bash
|
||||||
branding:
|
branding:
|
||||||
icon: git-pull-request
|
icon: git-pull-request
|
||||||
|
|
Loading…
Reference in a new issue