(cloneUrl: string, credentials: { username?: string, password: string })
| 246 | } |
| 247 | |
| 248 | const createGitCloneUrlWithToken = (cloneUrl: string, credentials: { username?: string, password: string }) => { |
| 249 | const url = new URL(cloneUrl); |
| 250 | // @note: URL has a weird behavior where if you set the password but |
| 251 | // _not_ the username, the ":" delimiter will still be present in the |
| 252 | // URL (e.g., https://:password@example.com). To get around this, if |
| 253 | // we only have a password, we set the username to the password. |
| 254 | // @see: https://www.typescriptlang.org/play/?#code/MYewdgzgLgBArgJwDYwLwzAUwO4wKoBKAMgBQBEAFlFAA4QBcA9I5gB4CGAtjUpgHShOZADQBKANwAoREj412ECNhAIAJmhhl5i5WrJTQkELz5IQAcxIy+UEAGUoCAJZhLo0UA |
| 255 | if (!credentials.username) { |
| 256 | url.username = credentials.password; |
| 257 | } else { |
| 258 | url.username = credentials.username; |
| 259 | url.password = credentials.password; |
| 260 | } |
| 261 | return url.toString(); |
| 262 | } |
| 263 | |
| 264 | |
| 265 | // setInterval wrapper that ensures async callbacks are not executed concurrently. |
no outgoing calls
no test coverage detected