From 94d5461e3ac8b1dc5cbe4097567d2f1149ea5de8 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Thu, 20 Jul 2023 13:10:43 -0700 Subject: [PATCH] Update the uncrustify bot, force a uncrustify failure to try the action --- .github/workflows/uncrustify.yml | 22 ++++++++++++++++++++-- source/FreeRTOS_DNS_Callback.c | 9 ++++++--- source/include/FreeRTOS_DNS.h | 4 ++-- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/uncrustify.yml b/.github/workflows/uncrustify.yml index be550aa0a..c989e715b 100644 --- a/.github/workflows/uncrustify.yml +++ b/.github/workflows/uncrustify.yml @@ -9,7 +9,6 @@ jobs: name: Run_Uncrustify if: ${{ github.event.issue.pull_request && github.event.comment.body == '/bot run uncrustify' }} runs-on: ubuntu-20.04 - container: ubuntu:18.04 steps: - name: Dump GitHub context env: @@ -41,16 +40,35 @@ jobs: repository: ${{ steps.upstreamrepo.outputs.RemoteRepo }} ref: ${{ steps.upstreambranch.outputs.branchname }} - name: Install Uncrustify - run: apt-get update && apt-get --assume-yes install uncrustify + run: | + : # Install Uncrustify + echo "::group::Install Uncrustify" + sudo apt-get update && apt-get --assume-yes install uncrustify + echo "::endgroup::" - name: Run Uncrustify run: | + : # Uncrustify on C files while ignoring symlinks. + : # Make a collapsible section in the log to run uncrustify + echo "::group::Uncrustify Check" uncrustify --version find . -iname "*.[hc]" -exec uncrustify -c tools/uncrustify.cfg --no-backup --replace {} + + echo "::endgroup::" + echo -e "\033[32;3mUncrustify Formatting Applied\033[0m" - name: Push changes to upstream repository run: | + : # Push changes to upstream repository + echo "::group::Push changes to upstream repository" git config --global --add safe.directory '*' git config --global user.name 'GitHub Action' git config --global user.email 'action@github.com' git add -A git commit -m "Uncrustify: triggered by comment." + echo "::endgroup::" git push + if [ "$?" = "0" ]; then + echo -e "\033[32;3mPushed formatting changes, don't forget to run 'git pull'!\033[0m" + exit 0 + else + echo -e "\033[32;31mFailed to push the formatting changes\033[0m" + exit 1 + fi diff --git a/source/FreeRTOS_DNS_Callback.c b/source/FreeRTOS_DNS_Callback.c index fb6b2cadf..0262e6eed 100644 --- a/source/FreeRTOS_DNS_Callback.c +++ b/source/FreeRTOS_DNS_Callback.c @@ -69,7 +69,7 @@ vTaskSuspendAll(); { - for( pxIterator = ( const ListItem_t * ) listGET_NEXT( xEnd ); + for( pxIterator = ( const ListItem_t * ) listGET_NEXT( xEnd ); pxIterator != ( const ListItem_t * ) xEnd; pxIterator = ( const ListItem_t * ) listGET_NEXT( pxIterator ) ) { @@ -77,12 +77,15 @@ DNSCallback_t * pxCallback = ( ( DNSCallback_t * ) listGET_LIST_ITEM_OWNER( pxIterator ) ); #if ( ipconfigUSE_MDNS == 1 ) /* mDNS port 5353. */ - if( pxSet->usPortNumber == FreeRTOS_htons( ipMDNS_PORT ) ) + if ( pxSet->usPortNumber == FreeRTOS_htons( ipMDNS_PORT ) ) { - /* In mDNS, the query ID field is ignored and the + /* In mDNS, the query ID field is ignored and the * hostname will be compared with outstanding requests. */ xMatching = ( strcasecmp( pxCallback->pcName, pxSet->pcName ) == 0 ) ? pdTRUE : pdFALSE; + + + } else #endif /* if ( ipconfigUSE_MDNS == 1 ) */ diff --git a/source/include/FreeRTOS_DNS.h b/source/include/FreeRTOS_DNS.h index 6fd10f3d9..f9e9f7d54 100644 --- a/source/include/FreeRTOS_DNS.h +++ b/source/include/FreeRTOS_DNS.h @@ -79,12 +79,12 @@ typedef enum xIPPreference { xPreferenceNone, xPreferenceIPv4, - #if ( ipconfigUSE_IPv6 != 0 ) + #if ( ipconfigUSE_IPv6 != 0 ) xPreferenceIPv6, #endif } IPPreference_t; -/** @brief This variable determines he choice of DNS server, either IPv4 or IPv6. */ +/** @brief This variable determines he choice of DNS server, either IPv4 or IPv6. */ extern IPPreference_t xDNS_IP_Preference; #if ( ipconfigUSE_NBNS != 0 )