mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-25 09:50:31 +00:00
Set commit.PullRequest for PullRequestHook
This commit is contained in:
parent
1fca69dade
commit
f17101be0d
1 changed files with 4 additions and 3 deletions
|
@ -181,7 +181,7 @@ func (g *GitlabHandler) Hook(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
|
||||||
_, err = database.GetCommitHash(parsed.After, repo.ID)
|
_, err = database.GetCommitHash(parsed.After, repo.ID)
|
||||||
if err != nil && err != sql.ErrNoRows {
|
if err != nil && err != sql.ErrNoRows {
|
||||||
println("commit already exists")
|
fmt.Println("commit already exists")
|
||||||
return RenderText(w, http.StatusText(http.StatusBadGateway), http.StatusBadGateway)
|
return RenderText(w, http.StatusText(http.StatusBadGateway), http.StatusBadGateway)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ func (g *GitlabHandler) PullRequestHook(p *gogitlab.HookPayload, repo *Repo, use
|
||||||
// Gitlab may trigger multiple hooks upon updating merge requests status
|
// Gitlab may trigger multiple hooks upon updating merge requests status
|
||||||
// only build when it was just opened and the merge hasn't been checked yet.
|
// only build when it was just opened and the merge hasn't been checked yet.
|
||||||
if !(obj.State == "opened" && obj.MergeStatus == "unchecked") {
|
if !(obj.State == "opened" && obj.MergeStatus == "unchecked") {
|
||||||
println("Ignore GitLab Merge Requests")
|
fmt.Println("Ignore GitLab Merge Requests")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ func (g *GitlabHandler) PullRequestHook(p *gogitlab.HookPayload, repo *Repo, use
|
||||||
|
|
||||||
_, err = database.GetCommitHash(src.Commit.Id, repo.ID)
|
_, err = database.GetCommitHash(src.Commit.Id, repo.ID)
|
||||||
if err != nil && err != sql.ErrNoRows {
|
if err != nil && err != sql.ErrNoRows {
|
||||||
println("commit already exists")
|
fmt.Println("commit already exists")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,6 +281,7 @@ func (g *GitlabHandler) PullRequestHook(p *gogitlab.HookPayload, repo *Repo, use
|
||||||
commit.Hash = src.Commit.Id
|
commit.Hash = src.Commit.Id
|
||||||
commit.Status = "Pending"
|
commit.Status = "Pending"
|
||||||
commit.Created = time.Now().UTC()
|
commit.Created = time.Now().UTC()
|
||||||
|
commit.PullRequest = strconv.Itoa(obj.IId)
|
||||||
|
|
||||||
commit.Message = src.Commit.Message
|
commit.Message = src.Commit.Message
|
||||||
commit.Timestamp = src.Commit.AuthoredDateRaw
|
commit.Timestamp = src.Commit.AuthoredDateRaw
|
||||||
|
|
Loading…
Reference in a new issue