Skip to content

Commit

Permalink
Add support for new token style
Browse files Browse the repository at this point in the history
[changelog:changed]
  • Loading branch information
cdupuis committed Apr 1, 2021
1 parent 85c1ab7 commit 08de32b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/repository/id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ export function gitHubComRepository(details: {
cloneUrl: (): string => {
if (details.credential) {
// GitHub App tokens start with v1. and are expected in the password field
if (details.credential.token.startsWith("v1.")) {
// See https://github.blog/changelog/2021-03-31-authentication-token-format-updates-are-generally-available/
if (
details.credential.token.startsWith("v1.") ||
details.credential.token.startsWith("ghu_") ||
details.credential.token.startsWith("ghs_") ||
details.credential.token.startsWith("ghr_")
) {
return `https://atomist:${details.credential.token}@github.com/${details.owner}/${details.repo}.git`;
} else {
return `https://${details.credential.token}:[email protected]/${details.owner}/${details.repo}.git`;
Expand Down

0 comments on commit 08de32b

Please sign in to comment.