forked from trezor/trezor-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (31 loc) · 1.1 KB
/
sync.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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