Skip to content

Sync with ppy:master #3

Sync with ppy:master

Sync with ppy:master #3

Workflow file for this run

name: Sync with ppy:master
on:
workflow_dispatch:
inputs:
backup:
default: false
description: Create a backup of the selected branch
required: true
type: boolean
overwrite:
default: false
description: Overwrite all history of the selected branch
required: true
type: boolean
jobs:
sync:
name: Sync with ppy:master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update branches
run: |
branch_name="$(git branch --show-current)"
backup_branch_name="$branch_name-backup"
if ${{ inputs.backup }}; then
printf '::notice::Backing up "%s" to "%s"\n' "$branch_name" "$backup_branch_name"
git push origin "HEAD:$backup_branch_name"
fi
git remote add upstream https://github.com/ppy/osu-wiki
git fetch upstream master
if ${{ inputs.overwrite }}; then
printf '::warning::Overwriting "%s"\n' "$branch_name"
git push --force origin "FETCH_HEAD:$branch_name"
else
printf '::notice::Merging into "%s"\n' "$branch_name"
git config user.name '${{ github.actor }}'
git config user.email '${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com'
git merge -m 'Merge master' FETCH_HEAD
git push origin "$branch_name"
fi