Skip to content

Update Submodules

Update Submodules #56

name: Update Submodules
on:
workflow_dispatch:
inputs:
title:
description: 'Title for the workflow run'
required: true
default: 'Triggered by API'
jobs:
update-submodules:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive # Initialize and fetch all submodules
- name: Update submodules to latest commit
run: |
git submodule update --remote
- name: Check for changes
id: changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changes=true" >> $GITHUB_ENV
else
echo "changes=false" >> $GITHUB_ENV
fi
- name: Commit and push changes
if: env.changes == 'true'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Updated submodules" -m "Triggered by ${{ github.event.inputs.title }}"
git push origin main