-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (40 loc) · 1.53 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
38
39
40
41
42
43
44
45
46
47
48
name: 'Upstream Sync'
on:
schedule:
- cron: '0 4 * * 1-5'
workflow_dispatch:
jobs:
sync_latest_from_upstream:
runs-on: ubuntu-latest
name: Sync latest commits from upstream repo
steps:
- name: Checkout target repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
persist-credentials: false
- name: Merge from upstream
env:
UPSTREAM: YoYoGames/GameMaker-Manual
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@users.noreply.github.com"
git --version
# Add upstream remote and fetch
git remote add upstream "https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${UPSTREAM}.git"
git remote -v
git fetch upstream
# Merge from upstream/develop with merge strategy to keep translation in case of conflicts
git merge -X ours upstream/develop
# this is dangerous but will essentially remove any files not staged in the merge
# this is useful since the merge strategy `-X ours` will not handle files where
# they have been deleted on only one branch
# Only use this you're sure that the failing merges fall under this category and are acceptable
# git diff --name-only --diff-filter=U | xargs git rm
git show-ref
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: ${{ github.ref }}