Skip to content

Commit 05cafe5

Browse files
Get Files Modified For Master Branch (#87)
1 parent ab5cd77 commit 05cafe5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

scripts/modified-files.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ touch /tmp/swissknife/modified_files.txt
99

1010
FILES_MODIFIED=""
1111
get_modified_files() {
12-
FILES_MODIFIED=""
13-
FILES_MODIFIED=$(git diff --name-only $(git merge-base HEAD origin/${BASE_BRANCH})..HEAD)
12+
if [[ "$CIRCLE_BRANCH" == "$BASE_BRANCH" ]]; then
13+
FILES_MODIFIED=$(git diff --name-only HEAD HEAD~1)
14+
else
15+
FILES_MODIFIED=$(git diff --name-only $(git merge-base HEAD origin/${BASE_BRANCH})..HEAD)
16+
fi
1417
}
1518

1619
get_modified_files

src/commands/modified-files.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
description: |
2-
Finds all modified files for a given commit and base-branch
2+
Finds all modified files for a given commit and base-branch.
3+
This will only work on master branches if your team uses only squash merges.
34
45
parameters:
56
base-branch:

0 commit comments

Comments
 (0)