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