Update Submodules #7
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: | |
jobs: | |
update-submodules: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository including submodules | |
- name: Checkout repository with submodules | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# Set Git committer identity | |
- name: Set Git committer identity | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
# Pull the latest changes for each submodule using merge strategy and resolve conflicts automatically | |
- name: Pull latest changes for submodules (auto resolve conflicts) | |
run: | | |
git submodule foreach 'git fetch && git merge -X theirs || true' | |
# Commit and push changes | |
- name: Commit and push changes | |
env: | |
TOKEN: ${{ secrets.wk_token }} # Use the PAT secret for authentication | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Update submodules with merged changes" | |
git push https://[email protected]/WatermelonKatanaDevs/WatermelonKatana.git HEAD | |
else | |
echo "No changes in submodules to commit." | |
fi |