Skip to content

.github/workflows/sync_upstream.yml #53

.github/workflows/sync_upstream.yml

.github/workflows/sync_upstream.yml #53

Workflow file for this run

on:
workflow_call:
workflow_dispatch:
schedule:
- cron: "0 16 * * *"
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
T=$(git tag -l)
git remote add upstream https://github.com/revanced/revanced-cli
git tag -d $T
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 -d $T
if ! git rebase -X ours upstream/main; then
git diff --name-only --diff-filter=U | xargs git rm
GIT_EDITOR=true git rebase --continue
fi
git push --tags -f
git push -f
else
echo "in sync"
fi