Update all submodules #96
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
# This is a basic workflow to help you get started with Actions | |
name: Update all submodules | |
on: | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
update: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
# Runs a single command using the runners shell | |
- name: Fetch all submodules | |
run: git submodule foreach -q 'BRANCH=$(git config -f $toplevel/.gitmodules submodule.$name.branch); git checkout $BRANCH; git reset --hard; git pull origin $BRANCH' | |
- name: Commit & push changes | |
run: | | |
git config --global user.name ${{ secrets.USER_NAME }} | |
git config --global user.email ${{ secrets.USER_EMAIL }} | |
git diff --quiet && git diff --staged --quiet || git commit -am "Updated submodules" && git push |