File tree 2 files changed +17
-16
lines changed
2 files changed +17
-16
lines changed Original file line number Diff line number Diff line change 2
2
3
3
# Get inputs from command
4
4
owner_repository=$1
5
- pr_number =$2
5
+ base_ref =$2
6
6
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
9
9
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)
12
12
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
- # Compare boards.txt file in the repo with the modified file
21
- diff=$( diff -u boards.txt boards_pr.txt)
13
+ # Check if the diff is empty
14
+ if [ -z " $diff " ]
15
+ then
16
+ echo " No changes in boards.txt file"
17
+ echo " FQBNS="
18
+ exit 0
19
+ fi
22
20
23
21
# Extract added or modified lines (lines starting with '+' or '-')
24
22
modified_lines=$( echo " $diff " | grep -E ' ^[+-][^+-]' )
25
23
24
+ # Print the modified lines for debugging
25
+ echo " Modified lines:"
26
+ echo " $modified_lines "
27
+
26
28
boards_array=()
27
29
previous_board=" "
28
- file=" boards.txt"
29
30
30
31
# Extract board names from the modified lines, and add them to the boards_array
31
32
while read -r line
Original file line number Diff line number Diff line change 29
29
30
30
- name : Get board name
31
31
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 }}
33
33
34
34
test-boards :
35
35
needs : find-boards
You can’t perform that action at this time.
0 commit comments