Update Sync.yml #7
This file contains hidden or 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 from Codeberg | |
| on: | |
| workflow_dispatch: | |
| push: | |
| schedule: | |
| - cron: "* * * * *" | |
| permissions: | |
| contents: write # allow pushing | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout current repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Clone Codeberg repo | |
| run: | | |
| git clone --depth=1 https://codeberg.org/ampmod/ampmod temp-src | |
| cp -r temp-src/* . | |
| rm -rf temp-src | |
| - name: Keep Any changes | |
| run: | | |
| rsync -av --ignore-existing temp-src/ . | |
| rsync -av --update temp-src/ . | |
| rm -rf temp-src | |
| - name: Commit changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| git commit -m "Sync from Codeberg repo" || echo "No changes to commit" | |
| - name: Push changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git push origin HEAD:develop |