Update Submodules #146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 user.name 'NSPBot911' | |
git config user.email ${{ secrets.BOT_EMAIL }} | |
git add --all | |
git commit -m "Updated submodules" -m "Triggered by ${{ github.event.inputs.title }}" | |
git pull origin main | |
git push origin main | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} |