Skip to content

Commit d83116e

Browse files
fix: autenticar mirror GitLab via PRIVATE-TOKEN header
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 651ab77 commit d83116e

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

.github/workflows/mirror-gitlab.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# Espelha main do GitHub para GitLab a cada push.
22
#
3-
# Segredos no GitHub (Settings → Secrets → Actions):
4-
# GITLAB_MIRROR_TOKEN — token ou senha do Deploy Token / Project Access Token
5-
# GITLAB_MIRROR_USER — opcional; padrao oauth2 (PAT pessoal) ou usuario do Deploy Token
6-
#
7-
# Recomendado (plano gratuito): Deploy Token no projeto GitLab
8-
# Settings → Repository → Deploy tokens → write_repository
3+
# Secret no GitHub: GITLAB_MIRROR_TOKEN
4+
# Token no GitLab: Project Access Token com write_repository
5+
# https://gitlab.com/mariahilmar-group/mgi-kpi-pipeline/-/settings/access_tokens
96

107
name: Mirror to GitLab
118

@@ -29,14 +26,13 @@ jobs:
2926

3027
- name: Push to GitLab
3128
env:
32-
GITLAB_MIRROR_USER: ${{ secrets.GITLAB_MIRROR_USER }}
3329
GITLAB_MIRROR_TOKEN: ${{ secrets.GITLAB_MIRROR_TOKEN }}
3430
run: |
3531
if [ -z "$GITLAB_MIRROR_TOKEN" ]; then
3632
echo "ERRO: defina GITLAB_MIRROR_TOKEN nos secrets do GitHub."
3733
exit 1
3834
fi
39-
GITLAB_USER="${GITLAB_MIRROR_USER:-oauth2}"
4035
git config user.name "github-actions[bot]"
4136
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
42-
git push "https://${GITLAB_USER}:${GITLAB_MIRROR_TOKEN}@gitlab.com/mariahilmar-group/mgi-kpi-pipeline.git" "HEAD:refs/heads/main"
37+
git remote add gitlab https://gitlab.com/mariahilmar-group/mgi-kpi-pipeline.git
38+
git -c "http.extraHeader=PRIVATE-TOKEN: ${GITLAB_MIRROR_TOKEN}" push gitlab HEAD:main

0 commit comments

Comments
 (0)