-
Notifications
You must be signed in to change notification settings - Fork 26
39 lines (37 loc) · 1.28 KB
/
Copy pathsync2.yml
File metadata and controls
39 lines (37 loc) · 1.28 KB
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: sync2mirror
on:
push:
branches:
- master
- dev
jobs:
repo-sync:
env:
gitcode_key: ${{ secrets.GITCODE_PRIVATE_KEY }}
gitcode_token: ${{ secrets.GITCODE_TOKEN }}
gitcode_user: ${{ secrets.GITCODE_USER }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Mask sensitive values
env:
MASK_OWNER: ${{ github.repository_owner }}
MASK_REPO: ${{ github.event.repository.name }}
MASK_TARGET: ${{ secrets.GITCODE_REPO_NAME }}
run: |
echo "::add-mask::${MASK_OWNER}"
echo "::add-mask::${MASK_REPO}"
echo "::add-mask::${MASK_TARGET}"
- name: sync
if: env.gitcode_key && env.gitcode_token && env.gitcode_user
run: |
git remote remove upstream-mirror 2>/dev/null || true
git remote add upstream-mirror "https://${GITCODE_USER}:${GITCODE_TOKEN}@gitcode.com/${GITCODE_USER}/${REPO_NAME}.git"
git push --force --progress upstream-mirror "HEAD:${GITHUB_REF_NAME}"
env:
GITCODE_USER: ${{ secrets.GITCODE_USER }}
GITCODE_TOKEN: ${{ secrets.GITCODE_TOKEN }}
REPO_NAME: ${{ secrets.GITCODE_REPO_NAME }}