File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ description : |
2+ Finds all modified files for a given commit and base-branch
3+
4+ parameters :
5+ base-branch :
6+ description : |
7+ The base branch for the repo.
8+ type : string
9+ default : master
10+ steps :
11+ - run :
12+ name : Swissknife - Get Changed Files
13+ command : |
14+ if [ -z "$BASH" ]; then
15+ echo Bash not installed.
16+ exit 1
17+ fi
18+ git status >/dev/null 2>&1 || { echo >&2 "Not in a git directory or no git"; exit 1; }
19+
20+ mkdir -p /tmp/swissknife
21+ touch /tmp/swissknife/modified_files.txt
22+
23+ FILES_MODIFIED=""
24+ get_modified_files() {
25+ FILES_MODIFIED=""
26+ FILES_MODIFIED=$(git diff --name-only $(git merge-base HEAD origin/<< parameters.base-branch >>)..HEAD)
27+ }
28+
29+ get_modified_files()
30+ if [ -z "$FILES_MODIFIED" ]
31+ then
32+ echo "Files not modified"
33+ else
34+ echo "$FILES_MODIFIED" >> /tmp/swissknife/modified_files.txt
35+ cat /tmp/swissknife/modified_files.txt
36+ fi
37+
You can’t perform that action at this time.
0 commit comments