Skip to content

Update Submodules

Update Submodules #259

# This workflow updated the submodules in the brightway2-data repository.
# it has been adapted from https://stackoverflow.com/a/67059629/
name: Update Submodules
on: # this workflow is triggered by the 'trigger_submodule_update_main' workflow in eg. brightway2-data.
workflow_dispatch:
jobs:
sync:
name: 'Update Submodules'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4 # https://github.com/actions/checkout/releases
with:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: true
- name: Update Submodules
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
- name: Commit Update
run: |
git config --global user.name 'GitHub Actions Submodule Updater'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "auto updated submodule" && git push || echo "no changes in submodule to commit"