-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.11 KB
/
sync.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Sync from Gitea repository
on:
schedule:
- cron: '0 * * * *' # 每小时运行一次
workflow_dispatch: # 手动触发
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Clone Gitea repository
env:
GITEA_URL: ${{ secrets.GITEA_URL }}
GITEA_USERNAME: ${{ secrets.GITEA_USERNAME }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
git clone --mirror https://${GITEA_USERNAME}:${GITEA_TOKEN}@${GITEA_URL} gitea_repo
- name: Sync changes to GitHub
env:
GITHUB_ACTOR: ${{ github.actor }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
cd gitea_repo
git remote set-url --push origin https://${GITHUB_ACTOR}:${GH_TOKEN}@github.com/YaKun9/SageTools.git
git push --mirror