Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
fix access_token_type for PR's
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Jul 22, 2019
1 parent 805216e commit 7464d43
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/scm/scm_github.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,19 @@ func (g *scmGithub) CheckoutPullRequestPayload(payload *Payload) error {
return berr
}

authRemote, aerr := authGitRemote(g.PipelineData.GitBaseInfo.Repo.CloneUrl, g.Config.GetString("scm_github_access_token"), "")
var gitRemoteUsername string
var gitRemotePassword string

if g.Config.GetString("scm_github_access_token_type") == "app" {
// see https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/
gitRemoteUsername = "x-access-token"
gitRemotePassword = g.Config.GetString("scm_github_access_token")
} else {
gitRemoteUsername = g.Config.GetString("scm_github_access_token")
gitRemotePassword = ""
}

authRemote, aerr := authGitRemote(g.PipelineData.GitBaseInfo.Repo.CloneUrl, gitRemoteUsername, gitRemotePassword)
if aerr != nil {
return aerr
}
Expand Down

0 comments on commit 7464d43

Please sign in to comment.