From e7317b2138a5c8ab5084f1acc6225b51387637df Mon Sep 17 00:00:00 2001 From: Wildan Mubarok Date: Sun, 13 Jul 2025 15:12:05 +0000 Subject: [PATCH] Use other token for pushing --- .gitlab-ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3338ca87a..8428870bc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,6 +61,12 @@ img: name: alpine/git:latest entrypoint: [""] # force an empty entrypoint script: + - | + if [ -z "$CI_PUSH_TOKEN" ]; then + echo "Error: CI_PUSH_TOKEN CI/CD variable is not set." + echo "Please configure CI_PUSH_TOKEN in your project's CI/CD settings -> Variables." + exit 1 + fi - git config user.email $GITLAB_USER_EMAIL - git config user.name "$GITLAB_USER_NAME (CI)" - git submodule update --remote $SUBMODULE_DIR @@ -71,7 +77,7 @@ img: echo "Changes detected for $SUBMODULE_DIR submodule. Committing and pushing..." git add $SUBMODULE_DIR git commit -m "CI: Update $SUBMODULE_DIR submodule to latest $CI_COMMIT_BRANCH" - git push origin HEAD + git push https://:${CI_PUSH_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git HEAD:$CI_COMMIT_BRANCH echo "Pushed! View the branch at: ${CI_SERVER_URL}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/-/tree/${CI_COMMIT_BRANCH}" fi