@@ -5,14 +5,13 @@ owner_repository=$1
55base_ref=$2 
66
77#  Download the boards.txt file from the base branch
8- curl -L -o boards_base.txt https://raw.githubusercontent.com/$owner_repository / $base_ref /boards.txt
8+ curl -L -o boards_base.txt https://raw.githubusercontent.com/" $owner_repository " / " $base_ref "  /boards.txt
99
1010#  Compare boards.txt file in the repo with the modified file from PR
1111diff=$( diff -u boards_base.txt boards.txt) 
1212
1313#  Check if the diff is empty
14- if  [ -z  " $diff "   ]
15- then 
14+ if  [ -z  " $diff "   ];  then 
1615    echo  " No changes in boards.txt file" 
1716    echo  " FQBNS=" 
1817    exit  0
2120#  Extract added or modified lines (lines starting with '+' or '-')
2221modified_lines=$( echo " $diff "   |  grep -E ' ^[+-][^+-]' ) 
2322
24- #   Print the modified lines for debugging
23+ #   Print the modified lines for debugging
2524echo  " Modified lines:" 
2625echo  " $modified_lines " 
2726
2827boards_array=()
2928previous_board=" " 
3029
3130#  Extract board names from the modified lines, and add them to the boards_array
32- while  read  -r line
33- do 
31+ while  read  -r line;  do 
3432    board_name=$( echo " $line "   |  cut -d ' .'   -f1 |  cut -d ' #'   -f1) 
3533    #  remove + or - from the board name at the beginning
36-     board_name=$( echo " $board_name "   |  sed ' s/^[+-]//' ) 
37-     if  [ " $board_name "   !=  " "   ] &&  [ " $board_name "   !=  " +"   ] &&  [ " $board_name "   !=  " -"   ] &&  [ " $board_name "   !=  " esp32_family"   ]
38-     then 
39-         if  [ " $board_name "   !=  " $previous_board "   ]
40-         then 
34+     board_name=${board_name# [-+]} 
35+     if  [ " $board_name "   !=  " "   ] &&  [ " $board_name "   !=  " +"   ] &&  [ " $board_name "   !=  " -"   ] &&  [ " $board_name "   !=  " esp32_family"   ];  then 
36+         if  [ " $board_name "   !=  " $previous_board "   ];  then 
4137            boards_array+=(" espressif:esp32:$board_name "  )
4238            previous_board=" $board_name " 
4339            echo  " Added 'espressif:esp32:$board_name ' to array" 
@@ -48,22 +44,19 @@ done <<< "$modified_lines"
4844#  Create JSON like string with all boards found and pass it to env variable
4945board_count=${# boards_array[@]} 
5046
51- if  [ $board_count  -gt  0 ]
52- then 
47+ if  [ " $board_count "   -gt  0 ];  then 
5348    json_matrix=' {"fqbn": [' 
54-     for  board  in  ${boards_array[@]} 
55-     do 
49+     for  board  in  " ${boards_array[@]} " ;  do 
5650        json_matrix+=' "' $board ' "' 
57-         if  [ $board_count  -gt  1 ]
58-         then 
51+         if  [ " $board_count "   -gt  1 ];  then 
5952            json_matrix+=" ," 
6053        fi 
61-         board_count=$(( $ board_count  -  1 )) 
54+         board_count=$(( board_count -  1 )) 
6255    done 
6356    json_matrix+=' ]}' 
6457
65-     echo  $json_matrix 
66-     echo  " FQBNS=${json_matrix} "   >>  $GITHUB_ENV 
58+     echo  " $json_matrix " 
59+     echo  " FQBNS=${json_matrix} "   >>  " $GITHUB_ENV " 
6760else 
68-     echo  " FQBNS="   >>  $GITHUB_ENV 
69- fi 
61+     echo  " FQBNS="   >>  " $GITHUB_ENV " 
62+ fi 
0 commit comments