3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-01-17 19:17:45 +00:00

Merge pull request #2 from tj-actions/feature/update-spacing

This commit is contained in:
Tonye Jack 2021-03-05 07:38:58 -05:00 committed by GitHub
commit a134aee20c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 32 deletions

View file

@ -15,20 +15,17 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: shellcheck - name: Run changed-files with defaults
uses: reviewdog/action-shellcheck@v1
- name: Run changed-files
id: changed-files id: changed-files
uses: ./ uses: ./
- name: Show output - name: Show output
run: | run: |
echo "Added Files: ${{ steps.changed-files.outputs.added_files }}" echo "${{ toJSON(steps.changed-files.outputs) }}"
echo "Copied Files: ${{ steps.changed-files.outputs.copied_files }}" - name: Run changed-files with comma separator
echo "Deleted Files: ${{ steps.changed-files.outputs.deleted_files }}" id: changed-files-comma
echo "Modified Files: ${{ steps.changed-files.outputs.modified_files }}" uses: ./
echo "Renamed Files: ${{ steps.changed-files.outputs.renamed_files }}" with:
echo "Changed Files: ${{ steps.changed-files.outputs.changed_files }}" separator: ","
echo "Unmerged Files: ${{ steps.changed-files.outputs.unmerged_files }}" - name: Show output
echo "Unknown Files: ${{ steps.changed-files.outputs.unknown_files }}" run: |
echo "All Changed Files: ${{ steps.changed-files.outputs.all_changed_files }}" echo "${{ toJSON(steps.changed-files-comma.outputs) }}"

View file

@ -1,6 +1,7 @@
History History
------- -------
v1 (2021-03-04) v1 (2021-03-04)
------------------ ------------------

View file

@ -2,30 +2,39 @@ name: Get modified files
description: Get modified files description: Get modified files
author: tj-actions author: tj-actions
inputs: inputs:
token: separator:
description: 'GITHUB_TOKEN or a Repo scoped PAT' description: 'Split character for array output'
required: true required: true
default: ${{ github.token }} default: " "
outputs: outputs:
added_files: added_files:
description: List of added files. description: List of added files.
value: ${{ steps.changed-files.outputs.added_files }}
copied_files: copied_files:
description: List of copied files. description: List of copied files.
value: ${{ steps.changed-files.outputs.copied_files }}
deleted_files: deleted_files:
description: List of deleted files. description: List of deleted files.
value: ${{ steps.changed-files.outputs.deleted_files }}
modified_files: modified_files:
description: List of modified files description: List of modified files.
value: ${{ steps.changed-files.outputs.modified_files }}
renamed_files: renamed_files:
description: List of renamed files. description: List of renamed files.
value: ${{ steps.changed-files.outputs.renamed_files }}
changed_files: changed_files:
description: List of changed files description: List of changed files.
value: ${{ steps.changed-files.outputs.changed_files }}
unmerged_files: unmerged_files:
description: List of unmerged files. description: List of unmerged files.
value: ${{ steps.changed-files.outputs.unmerged_files }}
unknown_files: unknown_files:
description: List of unknown files. description: List of unknown files.
value: ${{ steps.changed-files.outputs.unknown_files }}
all_changed_files: all_changed_files:
description: List of all changed files. description: List of all changed files.
value: ${{ steps.changed-files.outputs.all_changed_files }}
runs: runs:
using: 'composite' using: 'composite'
@ -40,26 +49,34 @@ runs:
TARGET_BRANCH=${GITHUB_BASE_REF} TARGET_BRANCH=${GITHUB_BASE_REF}
CURRENT_BRANCH=${GITHUB_HEAD_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} git fetch --depth=1 origin ${TARGET_BRANCH}:${TARGET_BRANCH}
echo "Getting head sha..." echo "Getting head sha..."
HEAD_SHA=$(git rev-parse ${TARGET_BRANCH} || true) HEAD_SHA=$(git rev-parse ${TARGET_BRANCH} || true)
ADDED=$(git diff --diff-filter=A --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" )
COPIED=$(git diff --diff-filter=C --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" )
DELETED=$(git diff --diff-filter=D --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" )
MODIFIED=$(git diff --diff-filter=M --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" )
RENAMED=$(git diff --diff-filter=R --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" )
CHANGED=$(git diff --diff-filter=T --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" )
UNMERGED=$(git diff --diff-filter=U --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" )
UNKNOWN=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" )
ALL_CHANGED=$(git diff --diff-filter='*' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" )
echo "Getting diff..." echo "Getting diff..."
echo "::set-output name=added_files::$(git diff --diff-filter=A --name-only ${HEAD_SHA} || true)" echo "::set-output name=added_files::$ADDED"
echo "::set-output name=copied_files::$(git diff --diff-filter=C --name-only ${HEAD_SHA} || true)" echo "::set-output name=copied_files::$COPIED"
echo "::set-output name=deleted_files::$(git diff --diff-filter=D --name-only ${HEAD_SHA} || true)" echo "::set-output name=deleted_files::$DELETED"
echo "::set-output name=modified_files::$(git diff --diff-filter=M --name-only ${HEAD_SHA} || true)" echo "::set-output name=modified_files::$MODIFIED"
echo "::set-output name=renamed_files::$(git diff --diff-filter=R --name-only ${HEAD_SHA} || true)" echo "::set-output name=renamed_files::$RENAMED"
echo "::set-output name=changed_files::$(git diff --diff-filter=T --name-only ${HEAD_SHA} || true)" echo "::set-output name=changed_files::$CHANGED"
echo "::set-output name=unmerged_files::$(git diff --diff-filter=R --name-only ${HEAD_SHA} || true)" echo "::set-output name=unmerged_files::$UNMERGED"
echo "::set-output name=unknown_files::$(git diff --diff-filter=X --name-only ${HEAD_SHA} || true)" echo "::set-output name=unknown_files::$UNKNOWN"
echo "::set-output name=all_changed_files::$(git diff --diff-filter="*" --name-only ${HEAD_SHA} || true)" echo "::set-output name=all_changed_files::$ALL_CHANGED"
shell: bash shell: bash
branding: branding:
icon: git-pull-request icon: git-pull-request
color: white color: white