Skip to content
Merged
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
56 changes: 56 additions & 0 deletions .github/workflows/update-submodules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Update Submodules

on:
schedule:
# Run at 2:00 AM UTC every day
- cron: '0 2 * * *'
workflow_dispatch: # Allow manual trigger

jobs:
update-submodules:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# Fetch all history for all branches and tags
fetch-depth: 0
# Get submodules
submodules: 'recursive'

- name: Set up Git
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'

- name: Get default branch
id: default_branch
run: |
DEFAULT_BRANCH=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)
echo "name=$DEFAULT_BRANCH" >> $GITHUB_OUTPUT

- name: Checkout default branch
run: |
git checkout ${{ steps.default_branch.outputs.name }}

- name: Update submodules
run: |
git submodule update --remote --recursive

- name: Check if submodules changed
id: check_changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "changes=false" >> $GITHUB_OUTPUT
fi

- name: Commit and push changes
if: steps.check_changes.outputs.changes == 'true'
run: |
git add -A
git commit -m "Auto-update submodules"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we can somehow wire up LLM to summarize the changes later...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That seems like an interesting idea. An alternative would be to list the new commits that the submodules got, but a more concise summary may be more useful.

git push origin ${{ steps.default_branch.outputs.name }}