Skip to content

Commit

Permalink
[nrf noup] Fix parsing PR description
Browse files Browse the repository at this point in the history
* Skip job if not a PR.
* Ignore grep errors.
* Check if PR description is not empty.

Signed-off-by: Adrian Gielniewski <[email protected]>
  • Loading branch information
adigie committed Feb 13, 2025
1 parent cb40b0d commit eb1b0a3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/examples-nrfconnect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ jobs:
shell:
- 'examples/shell/nrfconnect/**'
- name: Update NCS recommended version
if: github.event_name == 'pull_request'
run: |
PR_DESCRIPTION=$(jq -r '.pull_request.body' $GITHUB_EVENT_PATH)
NCS_PR_ID=$(echo $PR_DESCRIPTION | grep '^[^>]' | grep 'NCS PR' | sed 's/.*nrfconnect\/sdk-nrf//' | grep -oE '[0-9]+')
if [ -n "$NCS_PR_ID" ]; then
echo "Using NCS from pull/$NCS_PR_ID/head"
git -C $ZEPHYR_BASE/../nrf fetch origin pull/$NCS_PR_ID/head:NCS_PR
echo NCS_PR > config/nrfconnect/.nrfconnect-recommended-revision
else
echo "Using NCS from $(cat config/nrfconnect/.nrfconnect-recommended-revision)"
PR_DESCRIPTION="${{ github.event.pull_request.body }}"
if [[ -n "$PR_DESCRIPTION" ]]; then
NCS_PR_ID=$(echo $PR_DESCRIPTION | grep '^[^>]' | { grep 'NCS PR' || true; } | sed 's/.*nrfconnect\/sdk-nrf//' | { grep -oE '[0-9]+' || true; })
if [ -n "$NCS_PR_ID" ]; then
echo "Using NCS from pull/$NCS_PR_ID/head"
git -C $ZEPHYR_BASE/../nrf fetch origin pull/$NCS_PR_ID/head:NCS_PR
echo NCS_PR > config/nrfconnect/.nrfconnect-recommended-revision
else
echo "Using NCS from $(cat config/nrfconnect/.nrfconnect-recommended-revision)"
fi
fi
- name: Check nRF Connect SDK revision.
run: scripts/run_in_build_env.sh "python3 scripts/setup/nrfconnect/update_ncs.py --update"
Expand Down

0 comments on commit eb1b0a3

Please sign in to comment.