Skip to content

Mirror Codeberg to GitHub #1460

Mirror Codeberg to GitHub

Mirror Codeberg to GitHub #1460

Workflow file for this run

name: Mirror Codeberg to GitHub
on:
schedule:
- cron: '*/5 * * * *'
workflow_dispatch:
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Checkout Codeberg repository
run: |
git clone 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 || (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 --all
git push github --tags