Skip to content

从上游Gitea仓库同步更新 #3

从上游Gitea仓库同步更新

从上游Gitea仓库同步更新 #3

Workflow file for this run

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
run: |
cd gitea_repo
git remote set-url --push origin https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git push --mirror