Skip to content

Pull Submodules & Repackage #484

Pull Submodules & Repackage

Pull Submodules & Repackage #484

Workflow file for this run

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
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
# git config --local http.https://github.com/.extraheader "AUTHORIZATION: bearer ${{ secrets.GITHUB_TOKEN }}"
- name: Pull latest changes for the main repo
run: git pull origin $(git branch --show-current)
- name: Update submodules to the latest commit
run: |
git submodule update --init --recursive --depth=1 # Initialize all submodules first
git submodule foreach --recursive 'git fetch origin && git reset --hard origin/$(git rev-parse --abbrev-ref HEAD) || echo "Failed to reset 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)