Skip to content

⤵️ Merge in changes from upstream. Useful for syncing upstream changes to fork. 自动同步上游远程代码,支持私有仓库 fork

License

Notifications You must be signed in to change notification settings

zhangnew/sync-upstream

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sync Upstream

Sync changes from an upstream repository branch into a current repository branch. For example, updating changes from the repository that was forked from.

Current limitations:

  • only merge only selected branch
  • only work with public upstream Github repository
  • command is git rebase upstream/branch

To sync multiple branches, create multiple jobs.

Usage

Set up for scheduled trigger

copy and commit this to .github/workflows/sync-upstream.yml in your default branch of your repository.

name: Sync Upstream

permissions: write-all              # grant write permission

on: 
  schedule:
    - cron: '0 0 * * 1'             # scheduled for 00:00 every Monday
  workflow_dispatch:                # trigger manually

jobs:
  sync-upstream:
    runs-on: ubuntu-latest
    steps: 
      - name: Checkout
        uses: actions/checkout@v3
        with:
          ref: upstream             # set the branch to merge to
          fetch-depth: 0 
      - name: Sync Upstream
        uses: zhangnew/sync-upstream@v1
        with:
          upstream: owner/repo      # set the upstream repo
          upstream-branch: master   # set the upstream branch to merge from
          branch: upstream          # set the branch to merge to

  # set up another job to merge another branch
  sync-upstream-another-branch:
    runs-on: ubuntu-latest
    steps: 
      - name: Checkout
        uses: actions/checkout@v3
        with:
          ref: another-branch       # set the branch to merge to
          fetch-depth: 0 
      - name: Sync Upstream
        uses: zhangnew/sync-upstream@v1
        with:
          upstream: owner/repo              # set the upstream repo
          upstream-branch: another-branch   # set the upstream branch to merge from
          branch: another-branch            # set the branch to merge to

Reference:

About

⤵️ Merge in changes from upstream. Useful for syncing upstream changes to fork. 自动同步上游远程代码,支持私有仓库 fork

Topics

Resources

License

Stars

Watchers

Forks