Skip to content

sync

sync #128

Workflow file for this run

# Synchronize this repository with its upstream source (nkanaev/yarre)
name: sync
on:
# Run on the 1st of every month at 00:00 UTC
schedule:
- cron: '0 0 1 * *'
# Run when manually triggered
workflow_dispatch:
jobs:
synchronize:
name: Synchronize with upstream
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
# Checkout downstream (This repository) twice, once for the old state and once for the new state
- name: Checkout downstream (Old)
uses: actions/checkout@v4
with:
fetch-depth: 0
path: old
- name: Checkout downstream (New)
uses: actions/checkout@v4
with:
fetch-depth: 0
path: new
- name: Authenticate to Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git config --global user.password "${{ github.token }}"
- name: Setup upstream
working-directory: new
run: |
git remote add upstream https://github.com/nkanaev/yarr.git
- name: Pull upstream
working-directory: new
continue-on-error: true
run: |
git config pull.rebase false
git pull --strategy-option theirs --no-edit upstream master
git diff --name-only --diff-filter=U | xargs git rm
- name: Merge downstream
run: |
for file in .gitattributes .github Dockerfile entrypoint.sh readme.md; do
# Remove the new file
rm -rf new/$file
# Copy the old file
cp -rf old/$file new/$file
done
- name: Commit changes
working-directory: new
continue-on-error: true
run: git commit -am "Synchronize with upstream"
- name: Push changes
working-directory: new
run: git push origin main