Skip to content

Commit

Permalink
Merge pull request #16 from tj-actions/feature/add-support-for-all-mo…
Browse files Browse the repository at this point in the history
…dified-files

Add support for all modified files
  • Loading branch information
jackton1 committed Apr 11, 2021
2 parents d31b418 + 00d83b1 commit 8d5a33c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Using the default separator.
| unmerged_files | `string` | 'new.txt other.png ...' | Select only files that are Unmerged (U) |
| unknown_files | `string` | 'new.txt other.png ...' | Select only files that are Unknown (X) |
| all_changed_files | `string` | 'new.txt other.png ...' | Select all paths (*) <br /> *i.e a combination of all options above.* |
| all_modified_files | `string` | 'new.txt other.png ...' | Select all modified files (*) <br /> *i.e a combination of all added, <br />copied and modified files (ACM).* |


## Example
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ outputs:
all_changed_files:
description: List of all changed files.
value: ${{ steps.changed-files.outputs.all_changed_files }}
all_modified_files:
description: List of all changed modified and added files
value: ${{ steps.changed-files.outputs.all_modified_files }}

runs:
using: 'composite'
Expand Down Expand Up @@ -64,6 +67,7 @@ runs:
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='*ACDMRTUX' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
ALL_MODIFIED_FILES=$(git diff --diff-filter='ACM' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
echo "Getting diff..."
echo "::set-output name=added_files::$ADDED"
Expand All @@ -75,6 +79,7 @@ runs:
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"
shell: bash

branding:
Expand Down

0 comments on commit 8d5a33c

Please sign in to comment.