New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support GitHub App authentication for Jenkins integration #287
Comments
You mean an installation access token? THat's what |
|
I'm unsure if there's a difference between what Jenkins calls "GitHub App tokens" and what you call an installation token, but I'm passing this token as withCredentials([usernamePassword(credentialsId: '<creds-id>', usernameVariable: 'GITHUB_APP', passwordVariable: 'GITHUB_TOKEN')]) {
withCredentials([string(credentialsId: 'NPM_TOKEN', variable: 'NPM_TOKEN')]) {
withEnv(["GH_TOKEN=$GITHUB_TOKEN", "NPM_TOKEN=$NPM_TOKEN"]) {
sh "npx semantic-release --debug"
}
}
}Should I be passing this token in some other manner? |
|
Hmm I'm not familiar with Jenkins I'm afraid... I'm not sure how to debug the problem |
the most common way to use semantic-release with a "bot" account is to create a normal user account that is not associated with a real person and simply treat it as a bot account. github doesnt really provide such a thing as a bot account for this type of a purpose. simply create a personal access token from this account that you create to associate with that account instead of any particular person's personal account |
|
Ah thanks @travi. Yeah, that's what I do all the time for org-based projects, too |
This is what we're doing now, but we don't want another github account just for this purpose. This is exactly the reason that GithHub apps exist. octokit appears to support GitHub App authentication. I had initially thought that the way the semantic release github plugin provides the auth token might be to blame – it could be just https://github.com/semantic-release/github/blob/master/lib/get-client.js#L33 GitHub App tokens provided by the Jenkins integration do appear to work with this plugin. My issue is that the non-github-api uses of For posterity: Thanks for taking a look, and apologies for conflating these two authentication mechanisms. |
|
you can use a GitHub App's installation access token to authenticate git operations, however you need to set the username to We do that in But only when GitHub App environment variables are present. I remember we tried to make it work with any installation access tokens but it added too much complexity and/or was to unreliable, so we settled on just making it work for GitHub Actions, which is the most common usage. |
|
I tried this manner with my Package and Jenkins didn't recognise the Your help is appreciated ,,, |
Personal access tokens are currently required for the github plugin to work; cf. https://github.com/semantic-release/github/blob/master/README.md#environment-variables
GitHub App authentication is the recommended way to integrate GitHub access into Jenkins pipelines: https://www.jenkins.io/blog/2020/04/16/github-app-authentication/
Passing a GitHub App access token in the environment variable
GH_TOKENdoes not work with the github plugin. Is it possible to use a different environment variable or otherwise specify a GitHub App token for the github plugin to use?The text was updated successfully, but these errors were encountered: