Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): Chnage approach in listing the changed boards #18

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions .github/scripts/find_new_boards.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,31 @@

# Get inputs from command
owner_repository=$1
pr_number=$2
base_ref=$2

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

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

# 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
diff=$(diff -u boards.txt boards_pr.txt)
# Check if the diff is empty
if [ -z "$diff" ]
then
echo "No changes in boards.txt file"
echo "FQBNS="
exit 0
fi

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

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

boards_array=()
previous_board=""
file="boards.txt"

# Extract board names from the modified lines, and add them to the boards_array
while read -r line
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/boards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

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

test-boards:
needs: find-boards
Expand Down
4 changes: 4 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44367,3 +44367,7 @@ cezerio_dev_esp32c6.menu.ZigbeeMode.rcp.build.zigbee_mode=-DZIGBEE_MODE_RCP
cezerio_dev_esp32c6.menu.ZigbeeMode.rcp.build.zigbee_libs=-lesp_zb_api_rcp -lesp_zb_cli_command -lzboss_stack.rcp -lzboss_port

##############################################################

test_1.build.board=TEST_1
test_2.build.board=TEST_2
test_3.build.board=TEST_3
Loading