-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e698dc
commit 35d80f2
Showing
1 changed file
with
18 additions
and
31 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,23 @@ | ||
# https://stackoverflow.com/questions/64407333/using-github-actions-to-automatically-update-the-repos-submodules | ||
name: 'Submodules Sync' | ||
|
||
on: | ||
# Allows you to run this workflow manually from the Actions tab or through HTTP API | ||
workflow_dispatch: | ||
|
||
# source: https://gist.github.com/Supercip971/467846d7b12444275dbb4ac71cc192c4 | ||
name: update all submodules | ||
on: workflow_dispatch | ||
jobs: | ||
sync: | ||
name: 'Submodules Sync' | ||
build: | ||
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 | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: false | ||
|
||
# Update references | ||
- name: Git Sumbodule Update | ||
persist-credentials: false | ||
fetch-depth: 0 | ||
- name: Submodule update | ||
run: | | ||
git submodule update --init --recursive | ||
git submodule update --recursive --remote | ||
- name: Commit update | ||
run: | | ||
git config --global user.name 'GitHub bot' | ||
git config --global user.email '[email protected]' | ||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
git commit -am "Auto updated submodule" && git push || echo "No changes to commit" | ||
git submodule init | ||
git submodule update --remote --merge | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git commit -m "update submodule" -a | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref }} |