Skip to content

Commit

Permalink
Merge pull request #4 from fetchoracle/ll2125-submodules
Browse files Browse the repository at this point in the history
update-submodule
  • Loading branch information
jensendarren authored Aug 13, 2024
2 parents 8d782cf + c4a84c7 commit 7559e81
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/submodule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Submodule Sync

on:
workflow_dispatch:

jobs:
update-submodule:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.TOKEN_GITHUB }}

- name: Set up Git user
run: |
git config --global user.email "${{ secrets.GIT_USER_EMAIL }}"
git config --global user.name "${{ secrets.GIT_USER_NAME }}"
- name: Update submodule
id: update-submodule
run: |
CURRENT_TIMESTAMP=$(date +%Y%m%dT%H%M%S)
echo "CURRENT_TIMESTAMP=$CURRENT_TIMESTAMP" >> $GITHUB_ENV
echo $CURRENT_TIMESTAMP
git submodule update --remote --recursive
git submodule foreach --recursive "
if [ -n \"\$(git status --porcelain)\" ]; then
git switch -c $CURRENT_TIMESTAMP-submodule-sync &&
git commit -am \"submodule sync at $CURRENT_TIMESTAMP\" &&
git push origin $CURRENT_TIMESTAMP-submodule-sync
else
echo 'No changes to commit in submodule'
fi
"
if [ -n "$(git status --porcelain)" ]; then
git switch -c $CURRENT_TIMESTAMP-submodule-sync
git commit -am "submodule sync at $CURRENT_TIMESTAMP"
git push origin $CURRENT_TIMESTAMP-submodule-sync
else
echo 'No changes to commit in the main repository'
fi
- name: Create a pull request
run: |
PR_TITLE="Update-submodule"
echo "Creating pull request with title: $PR_TITLE"
gh pr create --title "$PR_TITLE" --body ""
env:
GH_TOKEN: ${{ secrets.TOKEN_GITHUB }}

0 comments on commit 7559e81

Please sign in to comment.