Skip to content

Commit ef6b0b6

Browse files
authored
Create fork_update.yml
1 parent 7030700 commit ef6b0b6

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/fork_update.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: 'Upstream Sync'
2+
3+
on:
4+
schedule:
5+
- cron: '0 7 * * *'
6+
# scheduled at 07:00 every Day
7+
8+
workflow_dispatch: # click the button on Github repo!
9+
inputs:
10+
sync_test_mode: # Adds a boolean option that appears during manual workflow run for easy test mode config
11+
description: 'Fork Sync Test Mode'
12+
type: boolean
13+
default: false
14+
15+
jobs:
16+
sync_latest_from_upstream:
17+
runs-on: ubuntu-latest
18+
name: Sync latest commits from upstream repo
19+
20+
steps:
21+
# REQUIRED step
22+
# Step 1: run a standard checkout action, provided by github
23+
- name: Checkout target repo
24+
uses: actions/checkout@v3
25+
with:
26+
# optional: set the branch to checkout,
27+
# sync action checks out your 'target_sync_branch' anyway
28+
ref: main
29+
# REQUIRED if your upstream repo is private (see wiki)
30+
persist-credentials: false
31+
32+
# REQUIRED step
33+
# Step 2: run the sync action
34+
- name: Sync upstream changes
35+
id: sync
36+
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4.1
37+
with:
38+
target_sync_branch: main
39+
# REQUIRED 'target_repo_token' exactly like this!
40+
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
41+
upstream_sync_branch: main
42+
upstream_sync_repo: linear-b/gitstream
43+
# Set test_mode true during manual dispatch to run tests instead of the true action!!
44+
test_mode: ${{ inputs.sync_test_mode }}
45+
46+
# Step 3: Display a sample message based on the sync output var 'has_new_commits'
47+
- name: New commits found
48+
if: steps.sync.outputs.has_new_commits == 'true'
49+
run: echo "New commits were found to sync."
50+
51+
- name: No new commits
52+
if: steps.sync.outputs.has_new_commits == 'false'
53+
run: echo "There were no new commits."
54+
55+
- name: Show value of 'has_new_commits'
56+
run: echo ${{ steps.sync.outputs.has_new_commits }}

0 commit comments

Comments
 (0)