Skip to content

Commit 77daf46

Browse files
authored
Create sync.yml
1 parent dcfcecc commit 77daf46

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/sync.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Upstream Sync
4+
5+
permissions:
6+
contents: write
7+
8+
on:
9+
schedule:
10+
- cron: "0 4 * * *" # At 12PM UTC+8
11+
workflow_dispatch:
12+
13+
jobs:
14+
sync_latest_from_upstream:
15+
name: Sync latest commits from upstream repo
16+
runs-on: ubuntu-latest
17+
if: ${{ github.event.repository.fork }}
18+
19+
steps:
20+
# Step 1: run a standard checkout action
21+
- name: Checkout target repo
22+
uses: actions/checkout@v4
23+
24+
# Step 2: run the sync action
25+
- name: Sync upstream changes
26+
id: sync
27+
uses: aormsby/[email protected]
28+
with:
29+
upstream_sync_repo: ngosang/trackerslist
30+
upstream_sync_branch: master
31+
target_sync_branch: master
32+
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Sync check
35+
if: failure()
36+
run: |
37+
echo "[Error] Due to a change in the workflow file of the upstream repository, GitHub has automatically suspended the scheduled automatic update. You need to manually sync your fork."
38+
exit 1

0 commit comments

Comments
 (0)