forked from leftwm/leftwm
-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (33 loc) · 1.19 KB
/
codeberg-mirror.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Mirror to Codeberg
on:
push:
pull_request:
jobs:
mirror:
name: Mirror to Codeberg
runs-on: ubuntu-latest
env:
MIRROR_REPO: ${{ secrets.CODEBERG_MIRROR_LEFTWM }}
steps:
- name: Checkout
if: env.MIRROR_REPO != ''
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Load ssh key
if: env.MIRROR_REPO != ''
run: |
umask 066
echo "${{ secrets.CODEBERG_MIRROR_LEFTWM_SSH_KEY }}" > ~/mirror_key
- name: Add Codeberg to known hosts
if: env.MIRROR_REPO != ''
run: echo "codeberg.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIVIC02vnjFyL+I4RHfvIGNtOgJMe769VTF1VR4EB3ZB" > ~/known_hosts
- name: Push to Codeberg
if: env.MIRROR_REPO != ''
env:
BRANCH: ${{ github.event_name == 'pull_request' && format('refs/heads/pull/{0}', github.event.number) || github.ref }}
GIT_SSH_COMMAND: 'ssh -i ~/mirror_key -o IdentitiesOnly=yes -o GlobalKnownHostsFile=~/known_hosts -o StrictHostKeyChecking=yes'
run: git push --force $MIRROR_REPO HEAD:$BRANCH
- name: Delete key file
if: env.MIRROR_REPO != ''
run: rm ~/mirror_key