Skip to content

Commit

Permalink
try to use another workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
rk42745417 committed Apr 22, 2024
1 parent 7e698dc commit 35d80f2
Showing 1 changed file with 18 additions and 31 deletions.
49 changes: 18 additions & 31 deletions .github/workflows/updateSubmodules.yml
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 }}

0 comments on commit 35d80f2

Please sign in to comment.