Skip to content

Commit b2ad759

Browse files
authored
Create fork.yml
1 parent 3bfe003 commit b2ad759

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/fork.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Upstream Sync'
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
schedule:
8+
- cron: '0 0 * * *'
9+
10+
workflow_dispatch:
11+
12+
jobs:
13+
sync_latest_from_upstream:
14+
runs-on: ubuntu-latest
15+
name: Sync latest commits from upstream repo
16+
17+
steps:
18+
- name: Checkout target repo
19+
uses: actions/checkout@v4
20+
with:
21+
ref: main
22+
23+
- name: Sync upstream changes
24+
id: sync
25+
uses: aormsby/[email protected]
26+
with:
27+
target_sync_branch: main
28+
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
29+
upstream_sync_branch: main
30+
upstream_sync_repo: Algorithms-and-Chickens/leetcode
31+
upstream_repo_access_token: ${{ secrets.UPSTREAM_REPO_SECRET }}
32+
33+
- name: New commits found
34+
if: steps.sync.outputs.has_new_commits == 'true'
35+
run: echo "New commits were found to sync."
36+
37+
- name: No new commits
38+
if: steps.sync.outputs.has_new_commits == 'false'
39+
run: echo "There were no new commits."
40+
41+
- name: Show value of 'has_new_commits'
42+
run: echo ${{ steps.sync.outputs.has_new_commits }}

0 commit comments

Comments
 (0)