chore: fix shellcheck findings across migration scripts
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
# shellcheck disable=SC2329
|
||||
|
||||
# =============================================================================
|
||||
# phase4_post_check.sh — Verify Phase 4 (Repo Migration) succeeded
|
||||
@@ -44,12 +45,14 @@ for repo in "${REPOS[@]}"; do
|
||||
log_info "--- Checking repo: ${repo} ---"
|
||||
|
||||
# Check 1: Repo exists on primary
|
||||
# shellcheck disable=SC2329
|
||||
check_repo_exists() {
|
||||
gitea_api GET "/repos/${GITEA_ORG_NAME}/$1" >/dev/null
|
||||
}
|
||||
run_check "Primary: ${GITEA_ORG_NAME}/${repo} exists" check_repo_exists "$repo"
|
||||
|
||||
# Check 2: Repo has commits (migration imported content)
|
||||
# shellcheck disable=SC2329
|
||||
check_commits() {
|
||||
local commits
|
||||
commits=$(gitea_api GET "/repos/${GITEA_ORG_NAME}/$1/commits?limit=1")
|
||||
@@ -60,6 +63,7 @@ for repo in "${REPOS[@]}"; do
|
||||
run_check "Primary: ${repo} has commits" check_commits "$repo"
|
||||
|
||||
# Check 3: Default branch matches GitHub source
|
||||
# shellcheck disable=SC2329
|
||||
check_default_branch() {
|
||||
local gitea_branch github_branch
|
||||
gitea_branch=$(gitea_api GET "/repos/${GITEA_ORG_NAME}/$1" | jq -r '.default_branch')
|
||||
@@ -69,12 +73,14 @@ for repo in "${REPOS[@]}"; do
|
||||
run_check "Primary: ${repo} default branch matches GitHub" check_default_branch "$repo"
|
||||
|
||||
# Check 4: Mirror exists on Fedora
|
||||
# shellcheck disable=SC2329
|
||||
check_mirror_exists() {
|
||||
gitea_backup_api GET "/repos/${GITEA_ADMIN_USER}/$1" >/dev/null
|
||||
}
|
||||
run_check "Fedora: ${GITEA_ADMIN_USER}/${repo} exists" check_mirror_exists "$repo"
|
||||
|
||||
# Check 5: Mirror has mirror=true
|
||||
# shellcheck disable=SC2329
|
||||
check_mirror_flag() {
|
||||
local is_mirror
|
||||
is_mirror=$(gitea_backup_api GET "/repos/${GITEA_ADMIN_USER}/$1" | jq -r '.mirror')
|
||||
|
||||
Reference in New Issue
Block a user