mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-23 10:21:00 +00:00
github author fallback for old GitHub enterprise
This commit is contained in:
parent
0ed2535b53
commit
aa8e0347d0
5 changed files with 30 additions and 5 deletions
|
@ -94,6 +94,21 @@ func PostHook(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// if there is no email address associated with the pull request,
|
||||
// we lookup the email address based on the authors github login.
|
||||
//
|
||||
// my initial hesitation with this code is that it has the ability
|
||||
// to expose your email address. At the same time, your email address
|
||||
// is already exposed in the public .git log. So while some people will
|
||||
// a small number of people will probably be upset by this, I'm not sure
|
||||
// it is actually that big of a deal.
|
||||
if len(build.Email) == 0 {
|
||||
author, err := model.GetUserLogin(db, build.Author)
|
||||
if err == nil {
|
||||
build.Email = author.Email
|
||||
}
|
||||
}
|
||||
|
||||
// if the remote has a refresh token, the current access token
|
||||
// may be stale. Therefore, we should refresh prior to dispatching
|
||||
// the job.
|
||||
|
|
|
@ -304,6 +304,7 @@ func (e *engine) runJob(r *Task, updater *updater, client dockerclient.Client) e
|
|||
},
|
||||
}
|
||||
|
||||
log.Infof("preparing container %s", name)
|
||||
client.PullImage(conf.Image, nil)
|
||||
|
||||
_, err = docker.RunDaemon(client, conf, name)
|
||||
|
|
|
@ -331,11 +331,16 @@ func (g *Github) push(r *http.Request) (*model.Repo, *model.Build, error) {
|
|||
build.Branch = strings.Replace(build.Ref, "refs/heads/", "", -1)
|
||||
build.Message = hook.Head.Message
|
||||
// build.Timestamp = hook.Head.Timestamp
|
||||
// build.Email = hook.Head.Author.Email
|
||||
build.Email = hook.Head.Author.Email
|
||||
build.Avatar = hook.Sender.Avatar
|
||||
build.Author = hook.Sender.Login
|
||||
build.Remote = hook.Repo.CloneURL
|
||||
|
||||
if len(build.Author) == 0 {
|
||||
build.Author = hook.Head.Author.Username
|
||||
// default gravatar?
|
||||
}
|
||||
|
||||
// we should ignore github pages
|
||||
if build.Ref == "refs/heads/gh-pages" {
|
||||
return nil, nil, nil
|
||||
|
|
|
@ -74,6 +74,9 @@ function JobViewModel(repo, build, job, status) {
|
|||
if (!data.jobs) {
|
||||
return;
|
||||
}
|
||||
if (data.number !== build) {
|
||||
return;
|
||||
}
|
||||
|
||||
var before = self.status;
|
||||
self.status = data.jobs[job-1].status;
|
||||
|
|
|
@ -17,8 +17,9 @@ block header
|
|||
a.nav-link[href="#"] API Reference
|
||||
|
||||
block content
|
||||
div.container-fluid.docs.docs-api
|
||||
div.container-fluid.docs.docs-usage
|
||||
div.row
|
||||
#{Site.Nav.HTML}
|
||||
div.row
|
||||
#{Page.HTML}
|
||||
div.content-nav
|
||||
#{Site.Nav.HTML}
|
||||
div.content-main
|
||||
#{Page.HTML}
|
Loading…
Reference in a new issue