|
| 1 | +name: Update Matter SDK submodule |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Runs at 04:30 UTC every day |
| 6 | + - cron: '04 30 * * *' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + pull-requests: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + update-submodule: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + # Checkout the repository |
| 19 | + - name: Checkout Repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + submodules: false |
| 23 | + |
| 24 | + # Update submodule (not recursive) |
| 25 | + - name: Update Submodule |
| 26 | + id: update-submodule |
| 27 | + run: | |
| 28 | + short_hash_before=$(cd connectedhomeip && git rev-parse --short HEAD) |
| 29 | + echo "short_hash_before=${short_hash_before}" > $GITHUB_OUTPUT |
| 30 | + git submodule update --remote connectedhomeip/ |
| 31 | + git add connectedhomeip/ |
| 32 | + if git diff-index --quiet HEAD; then |
| 33 | + echo "empty=true" > $GITHUB_OUTPUT |
| 34 | + exit 0 |
| 35 | + fi |
| 36 | + short_hash=$(cd connectedhomeip && git rev-parse --short HEAD) |
| 37 | + echo "short_hash=${short_hash}" > $GITHUB_OUTPUT |
| 38 | +
|
| 39 | + # Create Pull Request only if there were changes |
| 40 | + - name: Create Pull Request |
| 41 | + if: ! steps.update-submodule.outputs.empty |
| 42 | + uses: peter-evans/create-pull-request@v4 |
| 43 | + with: |
| 44 | + commit-message: Update Matter SDK to `${{steps.update-submodule.outputs.short_hash}}` |
| 45 | + title: Update Matter SDK to `${{steps.update-submodule.outputs.short_hash}}` |
| 46 | + body: | |
| 47 | + Bumps [connectedhomeip](https://github.com/project-chip/connectedhomeip) |
| 48 | + from `${{steps.update-submodule.outputs.short_hash_before}}` to |
| 49 | + `${{steps.update-submodule.outputs.short_hash}}`. |
| 50 | +
|
| 51 | + See full diff at |
| 52 | + https://github.com/project-chip/connectedhomeip/compare/${{steps.update-submodule.outputs.short_hash_before}}...${{steps.update-submodule.outputs.short_hash}}. |
| 53 | + branch: update-connectedhomeip-submodule-${{ github.run_id }} |
| 54 | + delete-branch: true |
| 55 | + |
0 commit comments