Allow setting git remote/branch
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
0af3def21f
commit
2e09698f75
1 changed files with 9 additions and 3 deletions
|
|
@ -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..."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue