Files
gentoo-zh/.github/workflows/mirror-to-codeberg.yml
Zakk 3b3edd4462 .github: use one naming and formatting style across workflows
Workflow names now match their file stems, so the Actions list and the
files read the same; generate-deps-relation-r1.yml becomes
deps-table.yml after the branch it maintains. Steps are lowercase and
verb-first, every step is named, and the autobump-rb checkout has one
name everywhere.

Also use 4-space step indentation, fromJSON, bare if: expressions,
github.actor for every ghcr login, uppercase env names, and the
GITHUB_REPOSITORY and GITHUB_REPOSITORY_OWNER variables the runner
already sets instead of REPO and OWNER copies. No behaviour changes.

Signed-off-by: Zakk <zakk@gentoozh.org>
2026-10-11 04:30:43 +11:00

37 lines
1.2 KiB
YAML

name: mirror-to-codeberg
on:
workflow_dispatch:
push:
branches: [master]
tags: ['**']
schedule:
- cron: '40 4 * * *'
concurrency:
group: mirror-to-codeberg
permissions:
contents: read
jobs:
mirror:
runs-on: ubuntu-latest
if: github.repository == 'gentoo-zh/overlay' && github.actor != 'dependabot[bot]'
steps:
- name: clone a bare mirror
run: git clone --mirror "https://github.com/${GITHUB_REPOSITORY}.git" repo.git
- name: push branches and tags to codeberg
working-directory: repo.git
env:
SSH_KEY: ${{ secrets.CODEBERG_SSH_KEY }}
run: |
install -dm700 ~/.ssh
printf '%s\n' "$SSH_KEY" > ~/.ssh/codeberg_mirror
chmod 600 ~/.ssh/codeberg_mirror
# matches the fingerprint at https://docs.codeberg.org/security/ssh-fingerprint/
echo 'codeberg.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIVIC02vnjFyL+I4RHfvIGNtOgJMe769VTF1VR4EB3ZB' > ~/.ssh/known_hosts
export GIT_SSH_COMMAND="ssh -i ~/.ssh/codeberg_mirror -o StrictHostKeyChecking=yes"
git push --prune git@codeberg.org:gentoo-zh/overlay.git \
'+refs/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*'