Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
git-merge

GitHub Action

Sync and merge upstream repository with your current repository

v0.1.2.b

Sync and merge upstream repository with your current repository

git-merge

Sync and merge upstream repository with your current repository

Syncs and merges your current repository with the upstream repository. Fork of https://github.com/mheene/sync-upstream-repo

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Sync and merge upstream repository with your current repository

uses: dabreadman/[email protected]

Learn more about this action in dabreadman/sync-upstream-repo

Choose a version

Sync Upstream Repo Fork

This is a Github Action used to merge changes from remote.

This is forked from mheene, with me adding authentication using GitHub Token and downstream branch options due to the default branch naming changes.

Use case

  • Perserve a repo while keeping up-to-date (rather than to clone it).
  • Have a branch in sync with upstream, and pull changes into dev branch.

Usage

Example github action here:

name: My_Pipeline_Name

### 
env:
  # Required, URL to upstream (fork base)
  UPSTREAM_URL: "https://github.com/dabreadman/go-web-proxy.git"
  # Optional, defaults to main
  DOWNSTREAM_BRANCH: "main"
### 

on:
  schedule:
    - cron: '30 * * * *'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: GitHub Sync to Upstream Repository
        uses: dabreadman/[email protected]
        with: 
          upstream_repo: ${{ env.UPSTREAM_URL }}
          branch: $$ env.DOWNSTREAM_BRANCH }}
          token: ${{ secrets.GITHUB_TOKEN}}

This action syncs your repo (merge changes from remote) at branch main with the upstream repo https://github.com/dabreadman/go-web-proxy.git every 30 minutes.

Mechanism

  1. Setup an environment using docker. (Why do that when Workflow is inside an environment? I have no idea).
  2. Pass arguments into entrypoint.sh.
  3. entrypoint.sh does the heavy lifting.
    git clone, set origin/upstream, fetch, merge, push.