Skip to content

Sync Fork Automatically #9

Sync Fork Automatically

Sync Fork Automatically #9

Workflow file for this run

name: Sync Fork Automatically
on:
schedule:
- cron: '0 */12 * * *' # Každých 12 hodín
workflow_dispatch: # Umožní manuálne spustenie
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Fork
uses: actions/checkout@v4
with:
fetch-depth: 0 # Aby sme mali celý git log
- name: Configure Git Identity
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Get Original Repository URL
id: get_upstream
run: |
UPSTREAM_URL=$(jq -r '.parent.html_url' <<< $(curl -s "https://api.github.com/repos/${{ github.repository }}"))
echo "UPSTREAM_URL=$UPSTREAM_URL" >> $GITHUB_ENV
- name: Add Upstream Remote and Fetch
run: |
git remote add upstream $UPSTREAM_URL || true
git fetch upstream
- name: Sync Fork with Upstream
run: |
git checkout main
git merge upstream/main --no-edit || git merge --abort
git push origin main