diff --git a/.github/workflows/ports_syscfg_check.yml b/.github/workflows/ports_syscfg_check.yml index 66d47a235..89ccd82e4 100644 --- a/.github/workflows/ports_syscfg_check.yml +++ b/.github/workflows/ports_syscfg_check.yml @@ -19,12 +19,20 @@ name: Check ports syscfg update -on: [pull_request] +on: + push: + branches: + - 'master' + paths: + - '*/syscfg.h' jobs: targets: name: Check ports syscfg update runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 @@ -52,23 +60,46 @@ jobs: newt upgrade --shallow=1 rm -rf repos/apache-mynewt-nimble git clone .. repos/apache-mynewt-nimble - cd .. - name: Build ports tests targets shell: bash run: | cd build ./repos/apache-mynewt-nimble/porting/update_generated_files.sh - cd repos/apache-mynewt-nimble - name: Check ports syscfg (debug) shell: bash if: runner.debug == '1' run: | + cd build/repos/apache-mynewt-nimble git diff - name: Check ports syscfg shell: bash run: | - git diff --quiet || (\ - echo -e "\033[0;31mChanges in system configration files detected."; - echo -e "\033[0;31mRun ./repos/apache-mynewt-nimble/porting/update_generated_files.sh" \ - "to update NimBLE ports configurations."; - exit 1) + cd build/repos/apache-mynewt-nimble + if ! git diff --quiet; then + echo -e "\033[0;31mChanges in system configuration files detected:" + git diff --name-only + cp porting/examples/linux/include/syscfg/syscfg.h ../../../porting/examples/linux/include/syscfg/syscfg.h + cp porting/examples/linux_blemesh/include/syscfg/syscfg.h ../../../porting/examples/linux_blemesh/include/syscfg/syscfg.h + cp porting/examples/nuttx/include/syscfg/syscfg.h ../../../porting/examples/nuttx/include/syscfg/syscfg.h + cp porting/nimble/include/syscfg/syscfg.h ../../../porting/nimble/include/syscfg/syscfg.h + cp porting/npl/riot/include/syscfg/syscfg.h ../../../porting/npl/riot/include/syscfg/syscfg.h + else + echo "No changes detected in system configuration files." + fi + cd ../../.. + rm -rf build + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: | + porting: Update ports syscfg + branch: update-ports-syscfg + title: "Update ports syscfg" + body: | + Update NimBLE ports configurations: + - Removes all /* */ comments from `syscfg.h` files. + - Adds the license header to each `syscfg.h` file. + - Auto-generated by [create-pull-request][1] + + [1]: https://github.com/peter-evans/create-pull-request