Skip to content

Commit 57080e0

Browse files
authored
Update GitLab remote URL with authentication token
1 parent e0c1638 commit 57080e0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/sync-pr-to-gitlab.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ jobs:
4545
if [ -z "$GITLAB_REPO_URL" ]; then
4646
echo "GITLAB_REPO_URL secret is not set"; exit 1;
4747
fi
48+
if [ -z "$GITLAB_TOKEN" ]; then
49+
echo "GITLAB_TOKEN secret is not set"; exit 1;
50+
fi
4851
4952
git config user.name "github-actions[bot]"
5053
git config user.email "github-actions[bot]@users.noreply.github.com"
54+
55+
AUTHED_URL="${GITLAB_REPO_URL/https:\/\//https:\/\/oauth2:${GITLAB_TOKEN}@}"
5156
52-
echo "Adding GitLab remote: $GITLAB_REPO_URL"
53-
git remote add gitlab "$GITLAB_REPO_URL"
57+
echo "Adding GitLab remote"
58+
git remote add gitlab "$AUTHED_URL"
5459
5560
echo "Pushing branch to GitLab as $PR_BRANCH"
5661
git push gitlab HEAD:"$PR_BRANCH" --force

0 commit comments

Comments
 (0)