Update Submodules #2122
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
name: Update Submodules | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- staging | |
- dev | |
schedule: | |
# Run this workflow hourly at *:17 UTC | |
- cron: "17 * * * *" | |
jobs: | |
update-submodules: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Update Submodules | |
run: | | |
git submodule update --init --remote src/pkgs | |
- name: Configure Git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Check for Changes | |
id: git-check | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "changes=changes present" >> $GITHUB_OUTPUT | |
else | |
echo "changes=" >> $GITHUB_OUTPUT | |
fi | |
- name: Setup SSH | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Commit and Push if Changes are Present | |
if: steps.git-check.outputs.changes != '' | |
run: | | |
git remote set-url origin git@github.com:${{ github.repository }}.git | |
git add . | |
git commit -m "Update submodules" | |
git push |