1+ name : ' Update matter_sdk submodule'
2+ description : ' Composite action to update the matter_sdk submodule and create a PR.'
3+ inputs :
4+ target_branch :
5+ description : ' Target branch to update the submodule on'
6+ required : true
7+ app-id :
8+ description : ' GitHub App ID'
9+ required : true
10+ private-key :
11+ description : ' GitHub App private key'
12+ required : true
13+ outputs :
14+ pr_branch :
15+ description : ' The name of the created PR branch (if any)'
16+ value : ${{ steps.update_submodule.outputs.pr_branch }}
17+ runs :
18+ using : ' composite'
19+ steps :
20+ - name : Generate GitHub App token
21+ id : generate_token
22+ uses : actions/create-github-app-token@v2
23+ with :
24+ app-id : ${{ inputs.app-id }}
25+ private-key : ${{ inputs.private-key }}
26+
27+ - name : Checkout repository
28+ uses : actions/checkout@v6
29+ with :
30+ ref : ${{ inputs.target_branch }}
31+ token : ${{ steps.generate_token.outputs.token }}
32+ submodules : false
33+
34+ - name : Update submodule
35+ id : update_submodule
36+ shell : bash
37+ run : |
38+ git submodule update --init third_party/matter_sdk
39+ short_hash_before=$(cd third_party/matter_sdk && git rev-parse --short HEAD)
40+ echo "short_hash_before=${short_hash_before}" >> $GITHUB_OUTPUT
41+ cd third_party/matter_sdk
42+ git fetch origin ${{ inputs.target_branch }}
43+ git checkout origin/${{ inputs.target_branch }}
44+ cd ../..
45+ git add third_party/matter_sdk
46+ if git diff-index --quiet HEAD; then
47+ echo "empty=true" >> $GITHUB_OUTPUT
48+ exit 0
49+ fi
50+ short_hash=$(cd third_party/matter_sdk && git rev-parse --short HEAD)
51+ echo "short_hash=${short_hash}" >> $GITHUB_OUTPUT
52+ echo "pr_branch=update-matter-sdk-${{ inputs.target_branch }}-${short_hash}" >> $GITHUB_OUTPUT
53+
54+ - name : Create PR
55+ if : steps.update_submodule.outputs.empty != 'true'
56+ id : create_pr
57+ uses : peter-evans/create-pull-request@v7
58+ with :
59+ token : ${{ steps.generate_token.outputs.token }}
60+ base : ${{ inputs.target_branch }}
61+ commit-message : " Update matter_sdk submodule to ${{ steps.update_submodule.outputs.short_hash }}"
62+ title : " [${{ inputs.target_branch }}] Update matter_sdk submodule to ${{ steps.update_submodule.outputs.short_hash }}"
63+ body : |
64+ Bumps matter_sdk submodule from `${{ steps.update_submodule.outputs.short_hash_before }}` to `${{ steps.update_submodule.outputs.short_hash }}`.
65+
66+ See diff at https://github.com/SiliconLabsSoftware/matter_sdk/compare/${{ steps.update_submodule.outputs.short_hash_before }}...${{ steps.update_submodule.outputs.short_hash }}
67+ branch : ${{ steps.update_submodule.outputs.pr_branch }}
0 commit comments