Files
tiennm99 2791d761b6 fix(ci): use canonical github-actions[bot] noreply email in mirror workflow
The previous 'actions@github.com' was a generic placeholder. Using the
canonical noreply form (id 41898282) ensures any commit attribution from
this workflow links to the github-actions bot profile.
2026-05-13 14:53:03 +07:00

99 lines
3.0 KiB
YAML

name: Mirror to other platforms
on:
push:
branches:
- '**'
workflow_dispatch:
jobs:
mirror:
runs-on: ubuntu-latest
name: Mirror Repository
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up SSH
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add known hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts
ssh-keyscan codeberg.org >> ~/.ssh/known_hosts
- name: Mirror to GitLab
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Add GitLab remote
git remote add gitlab git@gitlab.com:miti99/miti99.gitlab.io.git
# Fetch from GitLab to get information about the default branch
git fetch gitlab
# Get current branch name
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
# Get list of local branches
LOCAL_BRANCHES=$(git branch | grep -v "origin/" | tr -d '* ' | tr '\n' ' ')
# Push each local branch individually to GitLab
for branch in $LOCAL_BRANCHES; do
# Push branch to GitLab
git push gitlab $branch:$branch --force
done
# Push all tags
git push gitlab --tags --force
- name: Mirror to Bitbucket
run: |
# Add Bitbucket remote
git remote add bitbucket git@bitbucket.org:miti99/miti99.bitbucket.io.git
# Fetch from Bitbucket to get information about the default branch
git fetch bitbucket
# Get current branch name
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
# Get list of local branches
LOCAL_BRANCHES=$(git branch | grep -v "origin/" | tr -d '* ' | tr '\n' ' ')
# Push each local branch individually to Bitbucket
for branch in $LOCAL_BRANCHES; do
# Push branch to Bitbucket
git push bitbucket $branch:$branch --force
done
# Push all tags
git push bitbucket --tags --force
- name: Mirror to Codeberg
run: |
# Add Codeberg remote
git remote add codeberg ssh://git@codeberg.org/miti99/pages.git
# Fetch from Codeberg to get information about the default branch
git fetch codeberg
# Get list of local branches
LOCAL_BRANCHES=$(git branch | grep -v "origin/" | tr -d '* ' | tr '\n' ' ')
# Push each local branch individually to Codeberg
for branch in $LOCAL_BRANCHES; do
# Push branch to Codeberg
git push codeberg $branch:$branch --force
done
# Push all tags
git push codeberg --tags --force