Pull Submodules & Repackage #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: Pull Submodules & Repackage | |
on: | |
schedule: | |
- cron: '50 18 * * *' | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository with submodules | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Git | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "Osirys" | |
git config pull.ff only | |
- name: Pull latest changes for the main repo | |
run: git pull origin $(git branch --show-current) || echo "Failed to pull latest changes" | |
- name: Update submodules to the latest commit | |
run: | | |
git submodule update --init --recursive --depth=1 # Initialize all submodules first | |
git submodule foreach --recursive 'git checkout $(git rev-parse --abbrev-ref HEAD) && git pull --depth=1 origin || echo "Failed to update submodule"' | |
- name: Commit and push submodule changes | |
run: git diff --quiet && git diff --staged --quiet || (git add . && git commit -m "Updated submodules" && git push --force-with-lease || echo "Push failed") |