Mirror GitHub → Codeberg #435
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: Mirror GitHub → Codeberg | |
| on: | |
| push: | |
| branches: | |
| - main # ogni push su main | |
| workflow_dispatch: # pulsante "Run workflow" a mano | |
| schedule: | |
| - cron: "*/30 * * * *" # ogni 30 minuti | |
| jobs: | |
| mirror: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # prende tutta la history, non solo l’ultimo commit | |
| - name: Configure Git identity | |
| run: | | |
| git config --global user.name "Crovia Mirror Bot" | |
| git config --global user.email "mirror-bot@croviatrust.com" | |
| - name: Push to Codeberg | |
| env: | |
| CODEBERG_TOKEN: ${{ secrets.CODEBERG_TOKEN }} | |
| run: | | |
| # aggiunge il remote Codeberg usando il token | |
| git remote add codeberg "https://croviatrust:${CODEBERG_TOKEN}@codeberg.org/croviatrust/crovia-core-engine.git" || git remote set-url codeberg "https://croviatrust:${CODEBERG_TOKEN}@codeberg.org/croviatrust/crovia-core-engine.git" | |
| # push del ramo main | |
| git push --force --prune codeberg main | |
| # push dei tag (se in futuro li userai) | |
| git push --force --prune --tags codeberg |