Skip to content

Commit

Permalink
Update find_new_boards.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
P-R-O-C-H-Y committed Oct 23, 2024
1 parent 414b7b8 commit dbe32d8
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions .github/scripts/find_new_boards.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,9 @@
owner_repository=$1
base_ref=$2

#download the boards.txt file from the base branch
# Download the boards.txt file from the base branch
curl -L -o boards_base.txt https://raw.githubusercontent.com/$owner_repository/$base_ref/boards.txt

#url="https://api.github.com/repos/$owner_repository/pulls/$pr_number/files"
#echo $url

# Get changes in boards.txt file from PR
#Boards_modified_url=$(curl -s $url | jq -r '.[] | select(.filename == "boards.txt") | .raw_url')

# Echo the modified boards.txt file URL
#echo "Modified boards.txt file URL:"
#echo $Boards_modified_url

# Download the modified boards.txt file
#curl -L -o boards_pr.txt $Boards_modified_url

# Compare boards.txt file in the repo with the modified file from PR
diff=$(diff -u boards_base.txt boards.txt)

Expand All @@ -31,18 +18,13 @@ then
exit 0
fi

# Print the diff
echo "Diff:"
echo "$diff"

# Extract added or modified lines (lines starting with '+' or '-')
modified_lines=$(echo "$diff" | grep -E '^[+-][^+-]')

# Print the modified lines
# Print the modified lines for debugging
echo "Modified lines:"
echo "$modified_lines"


boards_array=()
previous_board=""

Expand All @@ -63,14 +45,6 @@ do
fi
done <<< "$modified_lines"

# Print all boards found
echo "Boards found:"
for board in ${boards_array[@]}
do
echo $board
done


# Create JSON like string with all boards found and pass it to env variable
board_count=${#boards_array[@]}

Expand Down

0 comments on commit dbe32d8

Please sign in to comment.