fix: refactor: extract setup_forge() from bin/disinto into lib/forge-setup.sh (#298) #307

Closed
dev-bot wants to merge 17 commits from fix/issue-298 into main
Showing only changes of commit cff90e927d - Show all commits

View file

@ -708,11 +708,15 @@ setup_forge() {
fi fi
else else
echo "Admin user: ${admin_user} (already exists)" echo "Admin user: ${admin_user} (already exists)"
# Reset password to the persisted value so basic-auth works (#158) # Only reset password if basic auth fails (#158, #267)
_forgejo_exec forgejo admin user change-password \ # Forgejo 11.x may ignore --must-change-password=false, blocking token creation
--username "${admin_user}" \ if ! curl -sf --max-time 5 -u "${admin_user}:${admin_pass}" \
--password "${admin_pass}" \ "${forge_url}/api/v1/user" >/dev/null 2>&1; then
--must-change-password=false _forgejo_exec forgejo admin user change-password \
--username "${admin_user}" \
--password "${admin_pass}" \
--must-change-password=false
fi
fi fi
# Preserve password for Woodpecker OAuth2 token generation (#779) # Preserve password for Woodpecker OAuth2 token generation (#779)
_FORGE_ADMIN_PASS="$admin_pass" _FORGE_ADMIN_PASS="$admin_pass"