Skip to content

Commit fda52b1

Browse files
committed
return deployment number in hook
1 parent 25d1c03 commit fda52b1

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

scm/driver/github/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ type status struct {
242242
}
243243

244244
type deployStatus struct {
245-
ID int `json:"id"`
245+
ID int64 `json:"id"`
246246
Environment string `json:"environment"`
247247
EnvironmentURL string `json:"environment_url"`
248248
State string `json:"state"`

scm/driver/github/testdata/webhooks/deployment.json.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"foo": "bar"
44
},
55
"Desc": "this is a description",
6+
"Number": 87972451,
67
"Ref": {
78
"Name": "master",
89
"Path": "refs/heads/master",

scm/driver/github/webhook.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ type (
239239
// github deployment webhook payload
240240
deploymentHook struct {
241241
Deployment struct {
242+
ID int64 `json:"id"`
242243
Creator user `json:"creator"`
243244
Description null.String `json:"description"`
244245
Environment null.String `json:"environment"`
@@ -359,8 +360,9 @@ func convertPullRequestHook(src *pullRequestHook) *scm.PullRequestHook {
359360

360361
func convertDeploymentHook(src *deploymentHook) *scm.DeployHook {
361362
dst := &scm.DeployHook{
362-
Data: src.Deployment.Payload,
363-
Desc: src.Deployment.Description.String,
363+
Number: src.Deployment.ID,
364+
Data: src.Deployment.Payload,
365+
Desc: src.Deployment.Description.String,
364366
Ref: scm.Reference{
365367
Name: src.Deployment.Ref.String,
366368
Path: src.Deployment.Ref.String,

scm/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ type (
8989

9090
// DeployStatus represents a deployment status.
9191
DeployStatus struct {
92-
Number int
92+
Number int64
9393
State State
9494
Desc string
9595
Target string

scm/webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ type (
105105
DeployHook struct {
106106
Data interface{}
107107
Desc string
108+
Number int64
108109
Ref Reference
109110
Repo Repository
110111
Sender User

0 commit comments

Comments
 (0)