Parse repository
(repository)
| 69 | |
| 70 | /**Parse repository */ |
| 71 | parse(repository) { |
| 72 | let branch = null, ref = null |
| 73 | if (typeof repository === "string") { |
| 74 | if (!this.parser.test(repository)) |
| 75 | throw new TypeError(`"${repository}" pattern is not supported`) |
| 76 | const {login, name, ...groups} = repository.match(this.parser)?.groups ?? {} |
| 77 | repository = {owner: {login}, name} |
| 78 | branch = groups.branch ?? null |
| 79 | ref = groups.ref ?? null |
| 80 | } |
| 81 | const repo = `${repository.owner.login}/${repository.name}` |
| 82 | const path = paths.join(os.tmpdir(), `${this.uid}-${repo.replace(/[^\w]/g, "_")}`) |
| 83 | return {repo, path, branch, ref} |
| 84 | } |
| 85 | |
| 86 | /**Clone a repository */ |
| 87 | async clone(repository) { |
no outgoing calls
no test coverage detected