Update mirror workflow to exclude upstream workflows #5
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: Partial Mirror Codeberg → GitHub (exclude workflows) | |
| on: | |
| workflow_dispatch: | |
| push: | |
| schedule: | |
| - cron: "*/30 * * * *" # sync every 30 minutes | |
| permissions: | |
| contents: write | |
| jobs: | |
| mirror: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone upstream (regular) | |
| run: | | |
| git clone https://codeberg.org/Calamares/calamares.git mirror | |
| cd mirror | |
| pip install git-filter-repo | |
| git filter-repo --path .github/workflows --invert-paths | |
| # Set GitHub as push target using Actions token | |
| git remote add github "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/teo/calamares.git" | |
| # Push all branches | |
| for branch in $(git for-each-ref --format='%(refname:short)' refs/heads/); do | |
| git push --force github "$branch" | |
| done | |
| # Push all tags | |
| git push --force github --tags |