giget icon indicating copy to clipboard operation
giget copied to clipboard

Try using `gh` cli token as fallback when cloning github sources

Open cpreston321 opened this issue 1 year ago • 1 comments
trafficstars

Describe the feature

Github already provides this locally if you auth with gh in this case it can cover most private repo cases without creating a new token . This can used by trying to run it with execa fallbacks to undefined

E.g

options.auth = options.auth || (await execa('gh', ['auth', 'token']).then(r => r.stdout).catch(() => undefined))

Maybe it can be a CLI param like --use-gh-auth that enables this function to that might be more viable.

Additional information

  • [X] Would you be willing to help implement this feature?

cpreston321 avatar Jan 11 '24 15:01 cpreston321

Hi thanks for this tip. We can also read the file directly from known path: https://github.com/unjs/changelogen/blob/main/src/github.ts#L120

Feel free to make a PR for this 👍🏼

pi0 avatar Mar 06 '24 12:03 pi0