Skip to content

Update Submodules

Update Submodules #943

name: Update Submodules
on:
# Run nightly: 8am UTC = 3am Eastern
schedule:
- cron: '0 8 * * *'
# Or run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
update-submodules:
# only run on the main repo; forks can pull changes from there
if: github.repository == 'TriForceX/MiyooCFW'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Github Personal Access Token
# needed because pushes with the deafult GITHUB_TOKEN won't trigger the build step
token: ${{ secrets.GH_PAT }}
# do NOT set submodules: true here - it does a funky checkout that keeps updating from working
- name: Update all submodules
id: update
run: |
git submodule init
# update submodules to the latest remote version
git submodule update --remote --merge
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idoutputs
echo "changes=$(git status -z --porcelain)" >> $GITHUB_OUTPUT
- name: Push changes
if: ${{ steps.update.outputs.changes }}
run: |
git config user.email "action@github.com"
git config user.name "GitHub Actions"
git commit -am "Updated submodules $(date)"
git push