| 107 | } |
| 108 | |
| 109 | const tokenRemoteUrl = ({ host, token }) => { |
| 110 | // this is a remote url that uses a github token as the username |
| 111 | // in order to authenticate with github |
| 112 | const headRemoteUrl = new URL(host.https()) |
| 113 | headRemoteUrl.username = token |
| 114 | // we have to manually change the protocol. the whatwg url spec |
| 115 | // does not allow changing a special protocol to another one |
| 116 | // but the protocol has to be `https:` without the `git+` |
| 117 | return headRemoteUrl.toString().replace('git+https:', 'https:') |
| 118 | } |
| 119 | |
| 120 | const main = async (spec, branch = 'main', opts) => withTempDir(CWD, async (tmpDir) => { |
| 121 | const { GITHUB_TOKEN } = process.env |