11#! /bin/bash
22
3+ STATUS=0
4+
5+ # remember last error code
6+ trap ' STATUS=$?' ERR
7+
8+ # problem matcher must exist in workspace
9+ cp /errors-matcher.json $HOME /file-sync-errors-matcher.json
10+ echo " ::add-matcher::$HOME /file-sync-errors-matcher.json"
11+
312echo " Repository: [$GITHUB_REPOSITORY ]"
413
514# log inputs
@@ -36,13 +45,13 @@ echo " "
3645
3746# loop through all the repos
3847for repository in " ${REPOSITORIES[@]} " ; do
39- echo " ###[ group] $repository "
48+ echo " :: group:: $repository "
4049
4150 # determine repo name
4251 REPO_INFO=($( echo $repository | tr " @" " \n" ) )
4352 REPO_NAME=${REPO_INFO[0]}
4453 echo " Repository name: [$REPO_NAME ]"
45-
54+
4655 # determine branch name
4756 BRANCH_NAME=" master"
4857 if [ ${REPO_INFO[1]+yes} ]; then
@@ -65,15 +74,15 @@ for repository in "${REPOSITORIES[@]}"; do
6574 fi
6675
6776 echo " "
68-
77+
6978 # loop through all files
7079 for file in " ${FILES[@]} " ; do
7180 echo " File: [${file} ]"
7281 # split and trim
7382 FILE_TO_SYNC=($( echo $file | tr " =" " \n" ) )
7483 SOURCE_PATH=${FILE_TO_SYNC[0]}
7584 echo " Source path: [$SOURCE_PATH ]"
76-
85+
7786 # initialize the full path
7887 SOURCE_FULL_PATH=" ${GITHUB_WORKSPACE} /${SOURCE_PATH} "
7988 echo " Source full path: [$SOURCE_FULL_PATH ]"
@@ -103,7 +112,7 @@ for repository in "${REPOSITORIES[@]}"; do
103112 # copy file
104113 echo " Copying: [$SOURCE_FULL_PATH ] to [$DEST_FULL_PATH ]"
105114 cp " ${SOURCE_FULL_PATH} " " ${DEST_FULL_PATH} " -r
106-
115+
107116 # add file
108117 git add " ${DEST_FULL_PATH} " -f
109118
@@ -137,5 +146,7 @@ for repository in "${REPOSITORIES[@]}"; do
137146 cd $TEMP_PATH
138147 rm -rf $REPO_NAME
139148 echo " Completed [${REPO_NAME} ]"
140- echo " ###[endgroup]"
141- done
149+ echo " ::endgroup::"
150+ done
151+
152+ exit $STATUS
0 commit comments