docs: add repository community metadata #2
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: Mirror | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: mirror-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| mirror: | |
| name: Mirror Git repository | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'mildman1848/postgresql' | |
| steps: | |
| - name: Checkout full history | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure SSH | |
| env: | |
| CODEBERG_MIRROR_SSH_KEY: ${{ secrets.CODEBERG_MIRROR_SSH_KEY }} | |
| GITLAB_MIRROR_SSH_KEY: ${{ secrets.GITLAB_MIRROR_SSH_KEY }} | |
| run: | | |
| set -euo pipefail | |
| if [[ -z "${CODEBERG_MIRROR_SSH_KEY}" ]]; then | |
| echo "CODEBERG_MIRROR_SSH_KEY is not configured" >&2 | |
| exit 2 | |
| fi | |
| if [[ -z "${GITLAB_MIRROR_SSH_KEY}" ]]; then | |
| echo "GITLAB_MIRROR_SSH_KEY is not configured" >&2 | |
| exit 2 | |
| fi | |
| install -d -m 700 ~/.ssh | |
| printf '%s\n' "${CODEBERG_MIRROR_SSH_KEY}" > ~/.ssh/codeberg_mirror | |
| printf '%s\n' "${GITLAB_MIRROR_SSH_KEY}" > ~/.ssh/gitlab_mirror | |
| chmod 600 ~/.ssh/codeberg_mirror ~/.ssh/gitlab_mirror | |
| ssh-keyscan codeberg.org gitlab.com >> ~/.ssh/known_hosts | |
| chmod 644 ~/.ssh/known_hosts | |
| cat > ~/.ssh/config <<'EOF' | |
| Host codeberg-mirror | |
| HostName codeberg.org | |
| User git | |
| IdentityFile ~/.ssh/codeberg_mirror | |
| IdentitiesOnly yes | |
| Host gitlab-mirror | |
| HostName gitlab.com | |
| User git | |
| IdentityFile ~/.ssh/gitlab_mirror | |
| IdentitiesOnly yes | |
| EOF | |
| chmod 600 ~/.ssh/config | |
| - name: Mirror main and tags | |
| run: | | |
| set -euo pipefail | |
| git remote add codeberg git@codeberg-mirror:mildman1848/postgresql.git | |
| git remote add gitlab git@gitlab-mirror:mildman1848/postgresql.git | |
| git push codeberg refs/heads/main:refs/heads/main | |
| git push gitlab refs/heads/main:refs/heads/main | |
| git push codeberg --tags | |
| git push gitlab --tags |