Currently global.appMode is used in a few places within the code to change behavior subtly if Renovate is running as a GitHub app. We should make this a first-class concept so that it's possible to supply an app-generated token for GitHub from the CLI.
global.appMode. If it used util/http/github then that should handle it for it.gomod artifacts code checks whether to use x-access-token in the git config lineplatform/github.initRepo() sets the auth differently depending on app or notutil/http/github manipulates the accept header depending on the mode/user API access when using an app token, as mentioned in https://github.com/renovatebot/config-help/issues/669I can think of two obvious choices for how to implement this:
appMode an admin option in config, instead of a global, ortoken should be specified as x-access-token:{token} to implicitly trigger app modeThe second option would mean that a few of the above will no longer need "app awareness" because the token won't need massaging anymore.
In either case our accept header should be dynamically set using hostRules (we may need to improve our headers merging logic so that it's a deep merge instead of shallow.
So:
util/http/github insteadtoken will already have the prefixhostRules entry + deep headers mergingAdditionally:
x-access-token: from the value put into the Authorization headerrelated to #3376
More pieces: we use a GraphQL query to fetch "our" issues, and for that we need to know our username. e.g. it is renovate[bot] for the official app. I guess we could reuse the username field for this and make it mandatory is an app token is provided. We similarly will need the gitAuthor value to be provided in config if it is not detectable using the /user endpoint.
More pieces: we use a GraphQL query to fetch "our" issues, and for that we need to know our username. e.g. it is
renovate[bot]for the official app. I guess we could reuse theusernamefield for this and make it mandatory is an app token is provided. We similarly will need thegitAuthorvalue to be provided in config if it is not detectable using the/userendpoint.
I would be happy to collaborate on this but I did not participate on the repo before. Woult it be ok if I draft PR somethig of this?
Thanks
sure, feel free to open a pr.
@dominguezcelada see #6454 6454
:tada: This issue has been resolved in version 22.18.0 :tada:
The release is available on:
22.18.0Your semantic-release bot :package::rocket: