Skip to content

Commit

Permalink
更新 .github/workflows/sync.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
YaKun9 committed Jun 12, 2024
1 parent 78a8b3b commit 88815da
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,18 @@ jobs:
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 https://${GITEA_USERNAME}:${GITEA_TOKEN}@${GITEA_URL} gitea_repo

- name: Sync changes to GitHub excluding .github directory
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: |
# Checkout the GitHub repository
git clone https://${GITHUB_ACTOR}:${GH_TOKEN}@github.com/${{ github.repository }} github_repo

# Use rsync to sync the code from Gitea repository to GitHub repository, excluding .github directory
rsync -av --exclude='.github' gitea_repo/ github_repo/

# Commit and push changes to GitHub repository
cd github_repo
git add .
git commit -m "Sync from Gitea excluding .github directory"
git push origin master
cd gitea_repo
git remote set-url --push origin https://${GITHUB_ACTOR}:${GH_TOKEN}@github.com/YaKun9/SageTools.git
git push --mirror

0 comments on commit 88815da

Please sign in to comment.