Skip to content

Commit f54b0ff

Browse files
committedFeb 12, 2023
ACTION: sync fork
1 parent 7cea6b2 commit f54b0ff

File tree

1 file changed

+43
-11
lines changed

1 file changed

+43
-11
lines changed
 

‎.github/workflows/sync.yml

+43-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,52 @@
1-
name: Sync Fork
1+
name: 'Upstream Sync'
22

33
on:
44
schedule:
55
- cron: '*/60 * * * *' # every 30 minutes
6-
workflow_dispatch: # on button click
76

8-
jobs:
9-
sync:
7+
workflow_dispatch: # click the button on Github repo!
108

9+
jobs:
10+
sync_latest_from_upstream:
1111
runs-on: ubuntu-latest
12+
name: Sync latest commits from upstream repo
1213

1314
steps:
14-
- uses: tgymnich/fork-sync@v1.8
15-
with:
16-
token: ${{ secrets.PERSONAL_TOKEN }}
17-
owner: ithaca-fv
18-
name: ithaca-fv
19-
base: master
20-
head: master
15+
# REQUIRED step
16+
# Step 1: run a standard checkout action, provided by github
17+
- name: Checkout target repo
18+
uses: actions/checkout@v2
19+
with:
20+
# optional: set the branch to checkout,
21+
# sync action checks out your 'target_sync_branch' anyway
22+
ref: master
23+
# REQUIRED if your upstream repo is private (see wiki)
24+
persist-credentials: false
25+
26+
# REQUIRED step
27+
# Step 2: run the sync action
28+
- name: Sync upstream changes
29+
id: sync
30+
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
31+
with:
32+
target_sync_branch: master
33+
# REQUIRED 'target_repo_token' exactly like this!
34+
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
35+
upstream_sync_branch: master
36+
upstream_sync_repo: aormsby/Fork-Sync-With-Upstream-action
37+
upstream_repo_access_token: ${{ secrets.UPSTREAM_REPO_SECRET }}
38+
39+
# Set test_mode true to run tests instead of the true action!!
40+
test_mode: true
41+
42+
# Step 3: Display a sample message based on the sync output var 'has_new_commits'
43+
- name: New commits found
44+
if: steps.sync.outputs.has_new_commits == 'true'
45+
run: echo "New commits were found to sync."
46+
47+
- name: No new commits
48+
if: steps.sync.outputs.has_new_commits == 'false'
49+
run: echo "There were no new commits."
50+
51+
- name: Show value of 'has_new_commits'
52+
run: echo ${{ steps.sync.outputs.has_new_commits }}

0 commit comments

Comments
 (0)
Please sign in to comment.