Skip to content

Configure git user and commit #8

Configure git user and commit

Configure git user and commit #8

name: Update submodules
# TODO: Remove push, only using push temporarily while building this workflow
on: [push]
# Manual workflow: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
#on: workflow_dispatch
# TODO: Use schedule below once finalized
#on:
# schedule:
# - cron: '17 8 10 * *' # Run monthly on the 10th, at 8:17am
# TODO:
# 1. Checkout then create a branch like submodules-update-<timestamp>
# 2. Run `git submodule update --remote --merge` to update all git submodules (https://stackoverflow.com/questions/8191299/update-a-submodule-to-the-latest-commit/42175412#42175412)
# 3. Commit results
# 4. Push branch
# 5. Open PR
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Set TODAY env var
run: echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Checkout project
uses: actions/checkout@v4
with:
submodules: true
- name: Create branch
run: git checkout -b submodules-update-$TODAY
- name: Run submodule updates
run: git submodule update --remote --checkout
- name: Configure git user
run: |
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}@users.noreply.github.com
- name: Commit
run: git commit --all -m "Update submodules $TODAY"
- name: Push branch
run: git push
- name: Open pull request
run: echo 'TODO'
#on: push
#jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - run: |
# date > generated.txt
# git config user.name github-actions
# git config user.email github-actions@github.com
# git add .
# git commit -m "generated"
# git push