Skip to content

Commit

Permalink
Add Modified Files Command (#84)
Browse files Browse the repository at this point in the history
* Add Modified Files Command
  • Loading branch information
ryan-timothy-albert authored Jun 17, 2021
1 parent d7bae4f commit e828fff
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/commands/modified-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
description: |
Finds all modified files for a given commit and base-branch
parameters:
base-branch:
description: |
The base branch for the repo.
type: string
default: master
steps:
- run:
name: Swissknife - Get Changed Files
command: |
if [ -z "$BASH" ]; then
echo Bash not installed.
exit 1
fi
git status >/dev/null 2>&1 || { echo >&2 "Not in a git directory or no git"; exit 1; }
mkdir -p /tmp/swissknife
touch /tmp/swissknife/modified_files.txt
FILES_MODIFIED=""
get_modified_files() {
FILES_MODIFIED=""
FILES_MODIFIED=$(git diff --name-only $(git merge-base HEAD origin/<< parameters.base-branch >>)..HEAD)
}
get_modified_files()
if [ -z "$FILES_MODIFIED" ]
then
echo "Files not modified"
else
echo "$FILES_MODIFIED" >> /tmp/swissknife/modified_files.txt
cat /tmp/swissknife/modified_files.txt
fi

0 comments on commit e828fff

Please sign in to comment.