forked from ReVanced/revanced-cli
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
3 changed files
with
55 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Sync upstream | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 15 * * *" | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.WF_TOKEN }} | ||
|
||
- name: sync | ||
id: sync | ||
shell: bash | ||
run: | | ||
git config --global user.name 'j-hc' | ||
git config --global user.email 'j-hc@users.noreply.github.com' | ||
if [[ $(git log | grep Author | head -1) == *"semantic"* ]]; then | ||
git reset --hard HEAD~1 | ||
fi | ||
git remote add upstream https://github.com/revanced/revanced-cli | ||
T=$(git tag --sort=creatordate | tail -1) | ||
git tag -d $(git tag -l) | ||
git fetch upstream --tags -f | ||
C=$(git rev-list --left-right --count origin/main...remotes/upstream/main | awk '{print$2}') | ||
echo "ahead $C commits" | ||
if [ "$C" -gt 0 ]; then | ||
echo "rebasing" | ||
git push origin --delete $T | ||
git rebase -X ours upstream/main | ||
git push --tags -f | ||
git push -f | ||
echo ::set-output name=SYNC::1 | ||
else | ||
echo "in sync" | ||
echo ::set-output name=SYNC::0 | ||
fi | ||
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
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