Mirror Codeberg to GitHub 2 #1756
Workflow file for this run
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: Mirror Codeberg to GitHub 2 | |
on: | |
schedule: | |
- cron: '*/5 * * * *' | |
workflow_dispatch: | |
jobs: | |
mirror: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Codeberg repository | |
run: | | |
git clone --branch catppuccin-mocha-with-animations https://codeberg.org/nnyyxxxx/dwm.git | |
- name: Add GitHub Remote | |
run: | | |
cd dwm | |
git remote add github https://nnyyxxxx:${{ secrets.GH_TOKEN }}@github.com/nnyyxxxx/dwm.git | |
- name: Fetch and Rebase Changes | |
run: | | |
cd dwm | |
git config --global user.email "${{ secrets.GIT_EMAIL }}" | |
git config --global user.name "${{ secrets.GIT_NAME }}" | |
git fetch github | |
git rebase github/catppuccin-mocha-with-animations || (echo "Rebase failed, resolving conflicts and skipping commits..." && git rebase --skip || (echo "Rebase failed again, aborting." && git rebase --abort)) | |
- name: Handle Rebase Conflicts | |
if: failure() | |
run: | | |
cd dwm | |
git status | |
# Automatically resolve common conflicts by keeping the local version | |
git checkout --ours . # Applies to all conflicted files | |
git add . | |
git rebase --continue || (echo "Rebase conflict not resolved. Aborting." && git rebase --abort) | |
- name: Push Changes to GitHub | |
run: | | |
cd dwm | |
git push github catppuccin-mocha-with-animations | |
git push github --tags |