From 2096f12513b344a3673abf08e9d3edc624b94d94 Mon Sep 17 00:00:00 2001 From: Wojciech Pietraszewski Date: Wed, 22 May 2024 13:30:34 +0200 Subject: [PATCH] ci: Submit PR updating ports syscfg files on merge Adds new step to the CI that creates a Pull Request with each 'syscfg.h' file if changes are detected. --- .github/workflows/ports_syscfg_check.yml | 47 ++++++++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ports_syscfg_check.yml b/.github/workflows/ports_syscfg_check.yml index 66d47a2350..89ccd82e45 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