Skip to content

Commit

Permalink
Update sync.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
roothider committed Jan 9, 2025
1 parent 88d8863 commit b291dd8
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Fork Sync

on:
schedule:
- cron: '*/30 * * * *' # every 30 minutes
- cron: '0 */3 * * *' # every 3 hours
workflow_dispatch: # on button click

jobs:
Expand All @@ -14,23 +14,32 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
submodules: recursive
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

- name: Merge upstream changes
run: |
set -e
set -x
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "[email protected]"
git remote add upstream https://github.com/theos/theos.git
git checkout master && git fetch upstream && git merge upstream/master
cd vendor/lib
git remote add upstream https://github.com/theos/lib.git
git checkout master && git fetch upstream && git merge upstream/master && git push
git submodule update --remote vendor/lib
git submodule update --remote vendor/include
git commit --all -m "[submodules] Update submodules to the latest commit" && git push || echo "No changes to submodules"
curl --fail -X PUT \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
https://api.github.com/repos/roothide/lib/actions/workflows/sync.yml/enable
curl --fail -X PUT \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
https://api.github.com/repos/roothide/headers/actions/workflows/sync.yml/enable
cd -
cd vendor/include
git remote add upstream https://github.com/theos/headers.git
git checkout master && git fetch upstream && git merge upstream/master && git push
cd -
# revert submodules to upstream commits
git submodule update --recursive
git commit --all -m "Sync Repo" && git push || echo "No changes"

0 comments on commit b291dd8

Please sign in to comment.