feat: support private repo cloning with HTTP basic auth
Deploy PR-Helper / deploy (push) Successful in 30s

- Add SSH URL detection with friendly prompt to use HTTPS instead
- Add private repo toggle (default off) with username/password fields
- Persist auth_type and credential in repositories table
- Pass stored credentials to PullRepo for authenticated pulls
- Incremental migration adds auth_type and credential columns
This commit is contained in:
2026-06-21 14:58:12 +08:00
parent 82666cff26
commit a6bd46db34
5 changed files with 108 additions and 21 deletions
+8
View File
@@ -99,6 +99,14 @@ func (db *DB) migrate() error {
return err
}
}
// Incremental migrations — ignore "duplicate column" errors for idempotency.
alterStmts := []string{
"ALTER TABLE repositories ADD COLUMN auth_type VARCHAR(20) NOT NULL DEFAULT 'none'",
"ALTER TABLE repositories ADD COLUMN credential TEXT",
}
for _, s := range alterStmts {
db.conn.Exec(s) // ignore error (column already exists)
}
return nil
}