Upstream Sync #370
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |