Skip to content

Commit

Permalink
ci: Submit PR updating ports syscfg files on merge
Browse files Browse the repository at this point in the history
Adds new step to the CI that creates
a Pull Request with each 'syscfg.h'
file if changes are detected.
  • Loading branch information
wpiet authored and sjanc committed Jun 20, 2024
1 parent 09ae1c4 commit 2096f12
Showing 1 changed file with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions .github/workflows/ports_syscfg_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 2096f12

Please sign in to comment.