Merge pull request #6 from Manarabdelaty/auto_update_submodules
[CI] Add workflow for auto-updating submodules
diff --git a/.github/workflows/auto_update_submodule.yml b/.github/workflows/auto_update_submodule.yml
new file mode 100644
index 0000000..7219ddf
--- /dev/null
+++ b/.github/workflows/auto_update_submodule.yml
@@ -0,0 +1,41 @@
+
+name: 'Auto-update Submodules'
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: "0 0 * * *"
+
+jobs:
+ sync:
+ name: 'Auto-update Submodules'
+ runs-on: ubuntu-latest
+
+ # Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
+ defaults:
+ run:
+ shell: bash
+
+ steps:
+ # Checkout the repository to the GitHub Actions runner
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ submodules: true
+
+ # Git config
+ - name: Git Configurations
+ run: |
+ git config --global user.name 'Git bot'
+ git config --global user.email 'bot@noreply.github.com'
+
+ # Update references
+ - name: Git Sumbodule Update
+ run: |
+ git submodule update --init --recursive
+ git submodule update --remote --recursive
+
+ - name: Commit update
+ run: |
+ git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
+ git commit -am "Auto updated submodule references" && git push || echo "No changes to commit"