Manual Update Submodules #6
Workflow file for this run
This file contains hidden or 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: Manual Update Submodules | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch to update (leave empty for current branch)' | |
required: false | |
default: '' | |
jobs: | |
update-submodules: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
ref: ${{ github.event.inputs.branch || github.ref }} | |
- name: Set up Git | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
- name: Get current branch | |
id: branch | |
run: | | |
if [[ -n "${{ github.event.inputs.branch }}" ]]; then | |
echo "name=${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT | |
else | |
CURRENT_BRANCH=${GITHUB_REF#refs/heads/} | |
echo "name=$CURRENT_BRANCH" >> $GITHUB_OUTPUT | |
fi | |
- 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 "Update submodules [skip ci]" | |
git push origin HEAD:${{ steps.branch.outputs.name }} |