@@ -104,19 +104,19 @@ jobs:
104
104
fi
105
105
106
106
PLUGIN_COVERAGE=""
107
- ## Set field delimiter so that we can easily split the path
108
- IFS='/'
107
+ ## Store original field delimiter value
108
+ BACKUP_IFS=$IFS
109
109
for i in "${!PATHS[@]}"; do
110
- read -a splitpath <<<${PATHS[i]}
111
- FINAL_ELEMENT=-1
112
- if [[ ${# PATHS[@ ]} -eq 1 ]]; then
113
- FINAL_ELEMENT=0
114
- fi
110
+ ## Reset field delimiter
111
+ IFS=$BACKUP_IFS
112
+ keyword=$(echo ${ PATHS[i ]} | awk -F '/' '{ print $NF }')
113
+ ## Set field delimiter so that we can easily grep the correct path in coverage result
114
+ IFS='/'
115
115
## Retrive line coverage from result
116
116
if [ $i -lt $((${#PATHS[@]} - 1)) ]; then
117
- PLUGIN_COVERAGE="$PLUGIN_COVERAGE$(echo $RESULT | grep ${splitpath[$FINAL_ELEMENT]} | head -1 | cut -d '|' -f 1,5) + "
117
+ PLUGIN_COVERAGE="$PLUGIN_COVERAGE$(echo $RESULT | grep $keyword | head -1 | cut -d '|' -f 1,5) + "
118
118
else
119
- PLUGIN_COVERAGE="$PLUGIN_COVERAGE$(echo $RESULT | grep ${splitpath[$FINAL_ELEMENT]} | head -1 | cut -d '|' -f 1,5)"
119
+ PLUGIN_COVERAGE="$PLUGIN_COVERAGE$(echo $RESULT | grep $keyword | head -1 | cut -d '|' -f 1,5)"
120
120
fi
121
121
done
122
122
echo "::set-output name=coverage::$(echo -e $PLUGIN_COVERAGE)"
@@ -193,19 +193,19 @@ jobs:
193
193
fi
194
194
195
195
PLUGIN_COVERAGE=""
196
- ## Set field delimiter so that we can easily split the path
197
- IFS='/'
196
+ ## Store original field delimiter value
197
+ BACKUP_IFS=$IFS
198
198
for i in "${!PATHS[@]}"; do
199
- read -a splitpath <<<${PATHS[i]}
200
- FINAL_ELEMENT=-1
201
- if [[ ${# PATHS[@ ]} -eq 1 ]]; then
202
- FINAL_ELEMENT=0
203
- fi
199
+ ## Reset field delimiter
200
+ IFS=$BACKUP_IFS
201
+ keyword=$(echo ${ PATHS[i ]} | awk -F '/' '{ print $NF }')
202
+ ## Set field delimiter so that we can easily grep the correct path in coverage result
203
+ IFS='/'
204
204
## Retrive line coverage from result
205
205
if [ $i -lt $((${#PATHS[@]} - 1)) ]; then
206
- PLUGIN_COVERAGE="$PLUGIN_COVERAGE$(echo $RESULT | grep ${splitpath[$FINAL_ELEMENT]} | head -1 | cut -d '|' -f 1,5) + "
206
+ PLUGIN_COVERAGE="$PLUGIN_COVERAGE$(echo $RESULT | grep $keyword | head -1 | cut -d '|' -f 1,5) + "
207
207
else
208
- PLUGIN_COVERAGE="$PLUGIN_COVERAGE$(echo $RESULT | grep ${splitpath[$FINAL_ELEMENT]} | head -1 | cut -d '|' -f 1,5)"
208
+ PLUGIN_COVERAGE="$PLUGIN_COVERAGE$(echo $RESULT | grep $keyword | head -1 | cut -d '|' -f 1,5)"
209
209
fi
210
210
done
211
211
echo "::set-output name=coverage::$(echo -e $PLUGIN_COVERAGE)"
0 commit comments