Skip to content

Commit 1f7de02

Browse files
authored
Create sync.yml
1 parent 9dc2d2f commit 1f7de02

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/sync.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: 'Upstream Sync'
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+
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/[email protected]
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: open-telemetry/opentelemetry-java-instrumentation
43+
upstream_repo_access_token: ${{ secrets.UPSTREAM_REPO_SECRET }}
44+
45+
# Set test_mode true during manual dispatch to run tests instead of the true action!!
46+
test_mode: false
47+
48+
# Step 3: Display a sample message based on the sync output var 'has_new_commits'
49+
- name: New commits found
50+
if: steps.sync.outputs.has_new_commits == 'true'
51+
run: echo "New commits were found to sync."
52+
53+
- name: No new commits
54+
if: steps.sync.outputs.has_new_commits == 'false'
55+
run: echo "There were no new commits."
56+
57+
- name: Show value of 'has_new_commits'
58+
run: echo ${{ steps.sync.outputs.has_new_commits }}

0 commit comments

Comments
 (0)