File tree Expand file tree Collapse file tree 2 files changed +27
-26
lines changed Expand file tree Collapse file tree 2 files changed +27
-26
lines changed Original file line number Diff line number Diff line change 1+ if [ -z " $BASH " ]; then
2+ echo Bash not installed.
3+ exit 1
4+ fi
5+ git status > /dev/null 2>&1 || { echo >&2 " Not in a git directory or no git" ; exit 1; }
6+
7+ mkdir -p /tmp/swissknife
8+ touch /tmp/swissknife/modified_files.txt
9+
10+ FILES_MODIFIED=" "
11+ get_modified_files () {
12+ FILES_MODIFIED=" "
13+ FILES_MODIFIED=$( git diff --name-only $( git merge-base HEAD origin/${BASE_BRANCH} ) ..HEAD)
14+ }
15+
16+ get_modified_files
17+ if [ -z " $FILES_MODIFIED " ]
18+ then
19+ echo " Files not modified"
20+ else
21+ echo " $FILES_MODIFIED " >> /tmp/swissknife/modified_files.txt
22+ cat /tmp/swissknife/modified_files.txt
23+ fi
Original file line number Diff line number Diff line change @@ -9,29 +9,7 @@ parameters:
99 default : master
1010steps :
1111 - 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-
12+ name : Swissknife - Get Modified Files
13+ environment :
14+ BASE_BRANCH : << parameters.base-branch >>
15+ command : << include(../scripts/modified-files.sh) >>
You can’t perform that action at this time.
0 commit comments