Skip to content

feat: new hc webhook fields #337

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

Merged
merged 2 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"target_repo_id": 13,
"target_branch": "main",
"merge_strategy": null,
"merge_base_sha": "5473eebbc0ce1d08981c955161b07a7989566b7b",
"author": {
"id": 8,
"uid": "0osgWsTZRsSZ8RWfjLRkEg",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"Created": "2023-02-02T18:21:25.38-08:00",
"Updated": "2023-02-02T18:21:25.38-08:00"
},
"Base": {
"Name": "main",
"Path": "refs/heads/main",
"Sha": "5473eebbc0ce1d08981c955161b07a7989566b7b"
},
"Head": {
"Name": "b",
"Path": "refs/heads/b",
"Sha": "f74f3d2a88d1b7cb19ff3bf069aa423763d341ef"
},
"Created": "0001-01-01T00:00:00Z",
"Updated": "0001-01-01T00:00:00Z"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"source_branch": "asdxsa",
"target_repo_id": 22,
"target_branch": "main",
"merge_base_sha": "5473eebbc0ce1d08981c955161b07a7989566b7b",
"author": {
"id": 3,
"uid": "admin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"Created": "2023-10-03T16:50:21.613+05:30",
"Updated": "2023-10-03T16:50:21.613+05:30"
},
"Base": {
"Name": "main",
"Path": "refs/heads/main",
"Sha": "5473eebbc0ce1d08981c955161b07a7989566b7b"
},
"Head": {
"Name": "asdxsa",
"Path": "refs/heads/asdxsa",
"Sha": "27822dd2ec788f924c97b0b194c5bfd906f2e574"
},
"Created": "0001-01-01T00:00:00Z",
"Updated": "0001-01-01T00:00:00Z"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"target_repo_id": 18,
"target_branch": "main",
"merge_strategy": null,
"merge_base_sha": "5473eebbc0ce1d08981c955161b07a7989566b7b",
"author": {
"id": 8,
"uid": "0osgWsTZRsSZ8RWfjLRkEg",
Expand Down Expand Up @@ -57,8 +58,48 @@
"git_url": "http://localhost:3000/git/asd/demo.git"
}
},
"sha": "f74f3d2a88d1b7cb19ff3bf069aa423763d341ef",
"commit": {
"sha": "f74f3d2a88d1b7cb19ff3bf069aa423763d341ef",
"message": "updated b2",
"author": {
"identity": {
"name": "Admin",
"email": "[email protected]"
},
"when": "2023-02-01T13:28:55-08:00"
},
"committer": {
"identity": {
"name": "Admin",
"email": "[email protected]"
},
"when": "2023-02-01T13:28:55-08:00"
}
},
"head_commit": {
"sha": "f74f3d2a88d1b7cb19ff3bf069aa423763d341ef",
"message": "updated b2",
"author": {
"identity": {
"name": "Admin",
"email": "[email protected]"
},
"when": "2023-02-01T13:28:55-08:00"
},
"committer": {
"identity": {
"name": "Admin",
"email": "[email protected]"
},
"when": "2023-02-01T13:28:55-08:00"
}
},
"comment": {
"id": 1,
"text": "pr comment"
"text": "pr comment",
"created": 1745471063621,
"updated": 1745471063621,
"kind": "comment"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"Number": 2,
"Title": "Update test.txt",
"Body": "",
"Sha": "",
"Sha": "f74f3d2a88d1b7cb19ff3bf069aa423763d341ef",
"Ref": "refs/heads/pr2",
"Source": "pr2",
"Target": "main",
Expand All @@ -32,6 +32,16 @@
"Created": "2023-02-02T18:21:25.38-08:00",
"Updated": "2023-02-02T18:21:25.38-08:00"
},
"Base": {
"Name": "main",
"Path": "refs/heads/main",
"Sha": "5473eebbc0ce1d08981c955161b07a7989566b7b"
},
"Head": {
"Name": "pr2",
"Path": "refs/heads/pr2",
"Sha": "f74f3d2a88d1b7cb19ff3bf069aa423763d341ef"
},
"Created": "0001-01-01T00:00:00Z",
"Updated": "0001-01-01T00:00:00Z"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"target_repo_id": 22,
"target_branch": "main",
"merge_strategy": "squash",
"merge_base_sha": "5473eebbc0ce1d08981c955161b07a7989566b7b",
"author": {
"id": 3,
"uid": "admin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"Created": "2023-10-03T16:50:21.613+05:30",
"Updated": "2023-10-03T16:50:21.613+05:30"
},
"Base": {
"Name": "main",
"Path": "refs/heads/main",
"Sha": "5473eebbc0ce1d08981c955161b07a7989566b7b"
},
"Head": {
"Name": "xas",
"Path": "refs/heads/xas",
"Sha": "4ec41187008f77222a60dfa21cdbd980f6490443"
},
"Created": "0001-01-01T00:00:00Z",
"Updated": "0001-01-01T00:00:00Z"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"target_repo_id": 13,
"target_branch": "main",
"merge_strategy": null,
"merge_base_sha": "5473eebbc0ce1d08981c955161b07a7989566b7b",
"author": {
"id": 8,
"uid": "0osgWsTZRsSZ8RWfjLRkEg",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"Created": "2023-02-02T18:21:25.38-08:00",
"Updated": "2023-02-02T18:21:25.38-08:00"
},
"Base": {
"Name": "main",
"Path": "refs/heads/main",
"Sha": "5473eebbc0ce1d08981c955161b07a7989566b7b"
},
"Head": {
"Name": "b",
"Path": "refs/heads/b",
"Sha": "d74b1ebfe520ac01b209dd9085f005884cc9f4cd"
},
"Created": "0001-01-01T00:00:00Z",
"Updated": "0001-01-01T00:00:00Z"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"target_repo_id": 13,
"target_branch": "main",
"merge_strategy": null,
"merge_base_sha": "5473eebbc0ce1d08981c955161b07a7989566b7b",
"author": {
"id": 8,
"uid": "0osgWsTZRsSZ8RWfjLRkEg",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"Created": "2023-02-02T18:21:25.38-08:00",
"Updated": "2023-02-02T18:21:25.38-08:00"
},
"Base": {
"Name": "main",
"Path": "refs/heads/main",
"Sha": "5473eebbc0ce1d08981c955161b07a7989566b7b"
},
"Head": {
"Name": "b",
"Path": "refs/heads/b",
"Sha": "f74f3d2a88d1b7cb19ff3bf069aa423763d341ef"
},
"Created": "0001-01-01T00:00:00Z",
"Updated": "0001-01-01T00:00:00Z"
},
Expand Down
14 changes: 14 additions & 0 deletions scm/driver/harness/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,12 @@ type (
State string `json:"state"`
IsDraft bool `json:"is_draft"`
Title string `json:"title"`
Description string `json:"description"`
SourceRepoID int `json:"source_repo_id"`
SourceBranch string `json:"source_branch"`
TargetRepoID int `json:"target_repo_id"`
TargetBranch string `json:"target_branch"`
MergeBaseSHA string `json:"merge_base_sha"`
MergeStrategy interface{} `json:"merge_strategy"`
Author principal `json:"author"`
PrURL string `json:"pr_url"`
Expand Down Expand Up @@ -356,15 +358,27 @@ func convertPullReq(pr pullReq, ref ref, commit hookCommit) scm.PullRequest {
return scm.PullRequest{
Number: pr.Number,
Title: pr.Title,
Body: pr.Description,
Closed: pr.State != "open",
Source: pr.SourceBranch,
Target: pr.TargetBranch,
Merged: pr.State == "merged",
Fork: "fork",
Link: pr.PrURL,
Draft: pr.IsDraft,
Sha: commit.Sha,
Ref: ref.Name,
Author: convertUser(pr.Author),
Head: scm.Reference{
Name: pr.SourceBranch,
Path: scm.ExpandRef(pr.SourceBranch, "refs/heads"),
Sha: commit.Sha,
},
Base: scm.Reference{
Name: pr.TargetBranch,
Path: scm.ExpandRef(pr.TargetBranch, "refs/heads"),
Sha: pr.MergeBaseSHA,
},
}
}

Expand Down