| 227 | } |
| 228 | |
| 229 | fn print_authentication_section(has_token: bool, session: Option<&SessionPayload>) { |
| 230 | let Some(session) = session else { |
| 231 | if has_token { |
| 232 | info!( |
| 233 | " {} Token expired (run {} to re-authenticate)", |
| 234 | cross_mark(), |
| 235 | style("codspeed auth login").cyan() |
| 236 | ); |
| 237 | } else { |
| 238 | info!( |
| 239 | " {} Not logged in (run {} to authenticate)", |
| 240 | cross_mark(), |
| 241 | style("codspeed auth login").cyan() |
| 242 | ); |
| 243 | } |
| 244 | return; |
| 245 | }; |
| 246 | |
| 247 | if let Some(user) = &session.user { |
| 248 | info!( |
| 249 | " {} Logged in as {} ({})", |
| 250 | check_mark(), |
| 251 | style(&user.login).bold(), |
| 252 | user.provider |
| 253 | ); |
| 254 | } else { |
| 255 | // Repo-bound, non-user token (automation today, repo tokens later). |
| 256 | info!(" {} Authenticated", check_mark()); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | /// Render the repository section. Returns whether the local-runs fallback |
| 261 | /// warning should be printed. |