Skip to content

Commit aebe542

Browse files
authored
Merge pull request #58 from home-assistant-libs/add-action-to-bump-dependency
Add workflow to bump Matter SDK dependency
2 parents b9826e1 + aec52d9 commit aebe542

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

.github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
updates:
33
- package-ecosystem: "gitsubmodule"
44
directory: "/"
5-
allow:
5+
ignore:
66
- dependency-name: "connectedhomeip"
77
schedule:
88
interval: "daily"
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+

.gitmodules

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
url = https://github.com/project-chip/connectedhomeip.git
44
branch = master
55
fetchRecurseSubmodules = false
6+
depth = 1

0 commit comments

Comments
 (0)