Skip to content

Commit

Permalink
Get Files Modified For Master Branch (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-timothy-albert committed Jun 30, 2021
1 parent ab5cd77 commit 05cafe5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions scripts/modified-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ touch /tmp/swissknife/modified_files.txt

FILES_MODIFIED=""
get_modified_files() {
FILES_MODIFIED=""
FILES_MODIFIED=$(git diff --name-only $(git merge-base HEAD origin/${BASE_BRANCH})..HEAD)
if [[ "$CIRCLE_BRANCH" == "$BASE_BRANCH" ]]; then
FILES_MODIFIED=$(git diff --name-only HEAD HEAD~1)
else
FILES_MODIFIED=$(git diff --name-only $(git merge-base HEAD origin/${BASE_BRANCH})..HEAD)
fi
}

get_modified_files
Expand Down
3 changes: 2 additions & 1 deletion src/commands/modified-files.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
description: |
Finds all modified files for a given commit and base-branch
Finds all modified files for a given commit and base-branch.
This will only work on master branches if your team uses only squash merges.
parameters:
base-branch:
Expand Down

0 comments on commit 05cafe5

Please sign in to comment.