Skip to content

Commit 473ed27

Browse files
authored
Create sync-fork.yml
sync fork workflow
1 parent 0563280 commit 473ed27

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflow/sync-fork.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Automate the Sync of the forked upstream repo
2+
3+
on:
4+
schedule:
5+
- cron: '0 7 * * 1,4'
6+
# scheduled at 07:00 every Monday and Thursday
7+
8+
workflow_dispatch: # click the button on Github repo!
9+
10+
11+
jobs:
12+
sync_with_upstream:
13+
runs-on: ubuntu-latest
14+
name: Sync main with upstream latest
15+
16+
steps:
17+
# Step 1: run a standard checkout action, provided by github
18+
- name: Checkout main
19+
uses: actions/checkout@v2
20+
with:
21+
ref: main
22+
# submodules: 'recursive' ### may be needed in your situation
23+
24+
# Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch
25+
- name: Pull (Fast-Forward) upstream changes
26+
id: sync
27+
uses: aormsby/[email protected]
28+
with:
29+
upstream_repository: thinkst/opencanary
30+
upstream_branch: master
31+
target_branch: main
32+
git_pull_args: --ff-only # optional arg use, defaults to simple 'pull'
33+
github_token: ${{ secrets.GITHUB_TOKEN }} # optional, for accessing repos that require authentication
34+
35+
# Step 3: Display a message if 'sync' step had new commits (simple test)
36+
- name: Check for new commits
37+
if: steps.sync.outputs.has_new_commits
38+
run: echo "There were new commits."
39+
40+
# Step 4: Print a helpful timestamp for your records (not required, just nice)
41+
- name: Timestamp
42+
run: date

0 commit comments

Comments
 (0)