Skip to content

Commit 414b7b8

Browse files
committed
Update workflow and script
1 parent 1e7f4ae commit 414b7b8

File tree

2 files changed

+13
-27
lines changed

2 files changed

+13
-27
lines changed

.github/scripts/find_new_boards.sh

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,26 @@
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
9+
10+
#url="https://api.github.com/repos/$owner_repository/pulls/$pr_number/files"
11+
#echo $url
912

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

1316
# Echo the modified boards.txt file URL
14-
echo "Modified boards.txt file URL:"
15-
echo $Boards_modified_url
17+
#echo "Modified boards.txt file URL:"
18+
#echo $Boards_modified_url
1619

1720
# 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 ]
22-
then
23-
echo "Error: boards.txt file not downloaded"
24-
exit 1
25-
fi
26-
27-
# cat both files
28-
echo "boards.txt file in the repo:"
29-
cat boards.txt
30-
echo "Modified boards.txt file:"
31-
cat boards_pr.txt
32-
33-
# Use sed to replace CRLF with LF
34-
sed -i 's/\r$//' boards.txt
35-
sed -i 's/\r$//' boards_pr.txt
21+
#curl -L -o boards_pr.txt $Boards_modified_url
3622

37-
# Compare boards.txt file in the repo with the modified file
38-
diff=$(diff -u boards.txt boards_pr.txt)
23+
# Compare boards.txt file in the repo with the modified file from PR
24+
diff=$(diff -u boards_base.txt boards.txt)
3925

4026
# Check if the diff is empty
4127
if [ -z "$diff" ]

.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)