Skip to content

Commit 2909b2c

Browse files
committed
fix(ci): Fix boards test
more logs more logs more logs
1 parent 2ad1804 commit 2909b2c

File tree

2 files changed

+12
-30
lines changed

2 files changed

+12
-30
lines changed

.github/scripts/find_new_boards.sh

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,29 @@
22

33
# Get inputs from command
44
owner_repository=$1
5-
pr_number=$2
5+
base_ref=$2
66

7-
url="https://api.github.com/repos/$owner_repository/pulls/$pr_number/files"
8-
echo $url
7+
# 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
99

10-
# Get changes in boards.txt file from PR
11-
Boards_modified_url=$(curl -s $url | jq -r '.[] | select(.filename == "boards.txt") | .raw_url')
10+
# Compare boards.txt file in the repo with the modified file from PR
11+
diff=$(diff -u boards_base.txt boards.txt)
1212

13-
# Echo the modified boards.txt file URL
14-
echo "Modified boards.txt file URL:"
15-
echo $Boards_modified_url
16-
17-
# Download the modified boards.txt file
18-
curl -L -o boards_pr.txt $Boards_modified_url
19-
20-
# Check if the file is downloaded
21-
if [ ! -f boards_pr.txt ]
13+
# Check if the diff is empty
14+
if [ -z "$diff" ]
2215
then
23-
echo "Error: boards.txt file not downloaded"
24-
exit 1
16+
echo "No changes in boards.txt file"
17+
echo "FQBNS="
18+
exit 0
2519
fi
2620

27-
# Compare boards.txt file in the repo with the modified file
28-
diff=$(diff -u boards.txt boards_pr.txt)
29-
3021
# Extract added or modified lines (lines starting with '+' or '-')
3122
modified_lines=$(echo "$diff" | grep -E '^[+-][^+-]')
3223

33-
# Print the modified lines
24+
# Print the modified lines for debugging
3425
echo "Modified lines:"
3526
echo "$modified_lines"
3627

37-
3828
boards_array=()
3929
previous_board=""
4030

@@ -55,14 +45,6 @@ do
5545
fi
5646
done <<< "$modified_lines"
5747

58-
# Print all boards found
59-
echo "Boards found:"
60-
for board in ${boards_array[@]}
61-
do
62-
echo $board
63-
done
64-
65-
6648
# Create JSON like string with all boards found and pass it to env variable
6749
board_count=${#boards_array[@]}
6850

.github/workflows/boards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
- name: Get board name
3131
run:
32-
bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.event.number}}
32+
bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.base_ref}}
3333

3434
test-boards:
3535
needs: find-boards

0 commit comments

Comments
 (0)