Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to bump Matter SDK dependency #58

Merged
merged 4 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
updates:
- package-ecosystem: "gitsubmodule"
directory: "/"
allow:
ignore:
- dependency-name: "connectedhomeip"
schedule:
interval: "daily"
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/dependency-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Update Matter SDK submodule

on:
schedule:
# Runs at 04:30 UTC every day
- cron: '30 04 * * *'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update-connectedhomeip-submodule:
runs-on: ubuntu-latest
name: Update Matter SDK submodule

steps:
# Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: false

# Update submodule (not recursive)
- name: Update Submodule
id: update-submodule
run: |
git submodule update --init connectedhomeip/
short_hash_before=$(cd connectedhomeip && git rev-parse --short HEAD)
echo "short_hash_before=${short_hash_before}" >> $GITHUB_OUTPUT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use outputs in another step within the same job even not defining jobs.<job_id>.outputs? I can't figure it out from the docs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They use the same syntax to define the output of the whole job. But yeah, it seems not documented. But it works 😅

git submodule update --remote connectedhomeip/
git add connectedhomeip/
if git diff-index --quiet HEAD; then
echo "empty=true" >> $GITHUB_OUTPUT
exit 0
fi
short_hash=$(cd connectedhomeip && git rev-parse --short HEAD)
echo "short_hash=${short_hash}" >> $GITHUB_OUTPUT

# Create Pull Request only if there were changes
- name: Create Pull Request
if: ${{ steps.update-submodule.outputs.empty != "true" }}
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update Matter SDK to `${{ steps.update-submodule.outputs.short_hash }}`
title: Update Matter SDK to `${{ steps.update-submodule.outputs.short_hash }}`
body: >
Bumps [connectedhomeip](https://github.com/project-chip/connectedhomeip)
from `${{ steps.update-submodule.outputs.short_hash_before }}` to
`${{ steps.update-submodule.outputs.short_hash }}`.


See full diff at
https://github.com/project-chip/connectedhomeip/compare/${{ steps.update-submodule.outputs.short_hash_before }}...${{ steps.update-submodule.outputs.short_hash }}.
branch: update-connectedhomeip-submodule-to-${{ steps.update-submodule.outputs.short_hash }}

1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
url = https://github.com/project-chip/connectedhomeip.git
branch = master
fetchRecurseSubmodules = false
depth = 1
Loading