From 2e09698f759dac5b257c2229ea6a9951dc3f9548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Thu, 26 Feb 2026 10:29:48 +0100 Subject: [PATCH] Allow setting git remote/branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- gitlab-job-status | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gitlab-job-status b/gitlab-job-status index d11b318..17aa966 100755 --- a/gitlab-job-status +++ b/gitlab-job-status @@ -4,6 +4,8 @@ set -euo pipefail # Configuration POLL_INTERVAL="${POLL_INTERVAL:-10}" GITLAB_TOKEN="${GITLAB_TOKEN:-}" +GIT_REMOTE="${GIT_REMOTE:-origin}" +GIT_BRANCH="${GIT_BRANCH:-}" # Colors for output RED='\033[0;31m' @@ -34,8 +36,8 @@ DISPLAY_LINES=0 # Extract GitLab host and project path from git remote parse_git_remote() { local remote_url - remote_url=$(git remote get-url origin 2>/dev/null) || { - log_error "Failed to get git remote 'origin'" + remote_url=$(git remote get-url "$GIT_REMOTE" 2>/dev/null) || { + log_error "Failed to get git remote '$GIT_REMOTE'" exit 1 } @@ -401,7 +403,11 @@ main() { log_info "Project: ${project_path}" local branch - branch=$(get_current_branch) + if [[ -z "$GIT_BRANCH" ]]; then + branch=$(get_current_branch) + else + branch="$GIT_BRANCH" + fi log_info "Branch: ${branch}" log_info "Finding merge request..."