Skip to content

Commit

Permalink
Update repo status not user status
Browse files Browse the repository at this point in the history
in case the user has no push premission
the testuite will not have enough permissions
to update the user status
  • Loading branch information
Lukas Matt committed Mar 13, 2018
1 parent b601417 commit 6e0618a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,15 @@ func (build *Build) UpdateStatus(client *github.Client, params... string) {
if len(params) >= 2 {
repoStatus.TargetURL = &params[1]
}

slug := strings.Split(build.Repo.Slug, "/")
if len(slug) <= 1 {
fmt.Printf("#%d: Invalid repor slug: %s\n", build.ID, build.Repo.Slug)
return
}

if _, _, err := client.Repositories.CreateStatus(context.Background(),
build.PRUser, build.PRRepo, build.PRSha, &repoStatus); err != nil {
slug[0], slug[1], build.PRSha, &repoStatus); err != nil {
fmt.Printf("#%d: Cannot update status: %+v\n", build.ID, err)
}
}
Expand Down

0 comments on commit 6e0618a

Please sign in to comment.