refactor: use REPO_NAMES in preflight.sh
- Replace REPO_1/2/3_NAME in required vars with REPO_NAMES - Update GitHub repos existence check to iterate REPO_NAMES - Update runner repos validation to check against REPO_NAMES words Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
20
preflight.sh
20
preflight.sh
@@ -171,14 +171,15 @@ check_runners_ini_format() {
|
||||
errors=$((errors + 1))
|
||||
fi
|
||||
|
||||
# repos: must be "all" or a known REPO_*_NAME
|
||||
# repos: must be "all" or a name from REPO_NAMES
|
||||
if [[ "$repos" != "all" ]] && [[ -n "$repos" ]]; then
|
||||
local repos_valid=false
|
||||
for var in REPO_1_NAME REPO_2_NAME REPO_3_NAME; do
|
||||
if [[ "$repos" == "${!var:-}" ]]; then repos_valid=true; break; fi
|
||||
local _rn
|
||||
for _rn in ${REPO_NAMES:-}; do
|
||||
if [[ "$repos" == "$_rn" ]]; then repos_valid=true; break; fi
|
||||
done
|
||||
if ! $repos_valid; then
|
||||
log_error " → [$section] repos='$repos' (must be 'all' or a known repo name)"
|
||||
log_error " → [$section] repos='$repos' (must be 'all' or a name from REPO_NAMES)"
|
||||
errors=$((errors + 1))
|
||||
fi
|
||||
fi
|
||||
@@ -244,7 +245,7 @@ REQUIRED_VARS=(
|
||||
GITEA_DOMAIN GITEA_INTERNAL_URL
|
||||
GITEA_BACKUP_INTERNAL_URL BACKUP_STORAGE_PATH
|
||||
GITHUB_USERNAME GITHUB_TOKEN
|
||||
REPO_1_NAME REPO_2_NAME REPO_3_NAME
|
||||
REPO_NAMES
|
||||
RUNNER_DEFAULT_IMAGE RUNNER_DEFAULT_DATA_PATH LOCAL_RUNNER_DATA_PATH
|
||||
NGINX_CONTAINER_NAME NGINX_CONF_PATH SSL_MODE
|
||||
)
|
||||
@@ -496,13 +497,8 @@ check_github_repos() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
for var in REPO_1_NAME REPO_2_NAME REPO_3_NAME; do
|
||||
local repo="${!var:-}"
|
||||
if [[ -z "$repo" ]]; then
|
||||
log_error " → ${var} is empty"
|
||||
all_ok=1
|
||||
continue
|
||||
fi
|
||||
local repo
|
||||
for repo in ${REPO_NAMES:-}; do
|
||||
if ! curl -sf -H "Authorization: token ${GITHUB_TOKEN:-}" "https://api.github.com/repos/${GITHUB_USERNAME}/${repo}" -o /dev/null 2>/dev/null; then
|
||||
log_error " → GitHub repo ${repo} not found under ${GITHUB_USERNAME}"
|
||||
all_ok=1
|
||||
|
||||
Reference in New Issue
Block a user