Sync Repo #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Repo | |
on: | |
workflow_dispatch: # Allows the action to be triggered manually | |
jobs: | |
mirror: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the private repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Configure Git user identity and safe directory | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Your Name" | |
git config --global --add safe.directory /github/workspace | |
- name: List contents of private repo (debug step) | |
run: ls -la | |
- name: Remove the Git directory from the private repo | |
run: | | |
rm -rf .git | |
- name: Checkout the public repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ClashKingInc/ClashKingAssets | |
token: ${{ secrets.PAT_TOKEN }} | |
path: public_repo | |
- name: Configure Git user identity for public repo | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Your Name" | |
git config --global --add safe.directory /github/workspace/public_repo | |
- name: List contents of public repo (debug step) | |
run: ls -la public_repo | |
- name: Copy files to the public repository | |
run: | | |
rsync -av --exclude=public_repo --exclude=.github ./ public_repo/ | |
- name: List contents of public repo after copy (debug step) | |
run: ls -la public_repo | |
- name: Commit and push changes to public repository | |
run: | | |
cd public_repo | |
git add . | |
git commit -m "Mirror update from private repo" || echo "No changes to commit" | |
git push --force |