Skip to content

Commit 060e16e

Browse files
committed
Update README.md
1 parent e612de8 commit 060e16e

File tree

1 file changed

+35
-14
lines changed

1 file changed

+35
-14
lines changed

README.md

+35-14
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,51 @@
11
# Sync Upstream Repo Fork
22

3-
This repository contains an github action to sync your current repository with an upstream repository. The work is greatly inspired by [actions-registry/github-repo-sync-upstream](https://github.com/actions-registry/github-repo-sync-upstream) which didn't work for me.
4-
Added parameter to determine target branch.
3+
This is a Github Action used to merge changes from remote.
4+
5+
This is forked from [mheene](https://github.com/mheene/sync-upstream-repo), with me adding authentication using [GitHub Token](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) and downstream branch options due to the [default branch naming changes](https://github.com/github/renaming).
6+
7+
## Use case
8+
9+
- Perserve a repo while keeping up-to-date (rather than to clone it).
10+
- Have a branch in sync with upstream, and pull changes into dev branch.
511

612
## Usage
713

8-
Example github action:
14+
Example github action [here](https://github.com/THIS-IS-NOT-A-BACKUP/go-web-proxy/blob/main/.github/workflows/sync5.yml):
915

1016
```YAML
11-
name: CI
17+
name: My_Pipeline_Name
1218

13-
on:
19+
###
20+
env:
21+
# Required, URL to upstream (fork base)
22+
UPSTREAM_URL: "https://github.com/dabreadman/go-web-proxy.git"
23+
# Optional, defaults to main
24+
DOWNSTREAM_BRANCH: "main"
25+
###
26+
27+
on:
1428
schedule:
15-
- cron: "15 14 * * *"
29+
- cron: '30 * * * *'
1630

1731
jobs:
1832
build:
1933
runs-on: ubuntu-latest
2034
steps:
21-
- uses: actions/checkout@v2
22-
- name: GitHub Sync to Upstream Repository
23-
uses: dabreadman/[email protected]
24-
with:
25-
# GitHub public upstream repo
26-
upstream_repo: https://github.com/holger24/AFD.git
27-
branch: main
35+
- name: GitHub Sync to Upstream Repository
36+
uses: dabreadman/[email protected]
37+
with:
38+
upstream_repo: ${{ env.UPSTREAM_URL }}
39+
branch: $$ env.DOWNSTREAM_BRANCH }}
40+
token: ${{ secrets.GITHUB_TOKEN}}
2841
```
2942
30-
This action syncs your repo at branch `main` with the upstream repo ``` https://github.com/holger24/AFD.git ``` every day at 14:15 UTC.
43+
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.
44+
45+
## Mechanism
46+
47+
1. Setup an environment using docker.
48+
(Why do that when `Workflow` is inside an environment? I have no idea).
49+
2. Pass arguments into `entrypoint.sh`.
50+
3. `entrypoint.sh` does the heavy lifting.
51+
git clone, set origin/upstream, fetch, merge, push.

0 commit comments

Comments
 (0)