-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (30 loc) · 1.02 KB
/
Copy pathmirror-gitlab.yml
File metadata and controls
35 lines (30 loc) · 1.02 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
# Espelha main do GitHub para GitLab sempre que houver push.
# Segredo necessário no GitHub: GITLAB_MIRROR_TOKEN (PAT GitLab com write_repository).
name: Mirror to GitLab
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: mirror-gitlab
cancel-in-progress: true
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push to GitLab
env:
GITLAB_MIRROR_TOKEN: ${{ secrets.GITLAB_MIRROR_TOKEN }}
run: |
if [ -z "$GITLAB_MIRROR_TOKEN" ]; then
echo "ERRO: defina o secret GITLAB_MIRROR_TOKEN no repositório GitHub."
exit 1
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote add gitlab "https://oauth2:${GITLAB_MIRROR_TOKEN}@gitlab.com/mariahilmar-group/mgi-kpi-pipeline.git"
git push gitlab "HEAD:refs/heads/main"