Skip to content

Commit 2877ffa

Browse files
fix: ref should be branch name for harness code (#288)
* fix: ref should be branch name for harness code * fix: add uid for harness webhook
1 parent e6556d1 commit 2877ffa

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

scm/driver/harness/repo.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func (s *repositoryService) CreateHook(ctx context.Context, repo string, input *
7575
in := new(hook)
7676
in.Enabled = true
7777
in.DisplayName = input.Name
78+
in.UID = input.Name
7879
in.Secret = input.Secret
7980
in.Insecure = input.SkipVerify
8081
in.URL = input.Target
@@ -134,6 +135,7 @@ type (
134135
HasSecret bool `json:"has_secret"`
135136
Secret string `json:"secret"`
136137
ID int `json:"id"`
138+
UID string `json:"uid"`
137139
Insecure bool `json:"insecure"`
138140
LatestExecutionResult string `json:"latest_execution_result"`
139141
ParentID int `json:"parent_id"`

scm/driver/harness/testdata/webhooks/branch_create.json.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Ref": "aeafa0e2e4ec6909ad75cb8fad57c0b1eb5986e6",
2+
"Ref": "refs/heads/new2",
33
"Before": "0000000000000000000000000000000000000000",
44
"After": "aeafa0e2e4ec6909ad75cb8fad57c0b1eb5986e6",
55
"Repo": {

scm/driver/harness/testdata/webhooks/branch_updated.json.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Ref": "92e21bfcddc1418079cddbb518ad6fd72917798a",
2+
"Ref": "refs/heads/master",
33
"Before": "a273c385628167932e10caaa58e12550c491f241",
44
"After": "92e21bfcddc1418079cddbb518ad6fd72917798a",
55
"Repo": {

scm/driver/harness/webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func convertPullRequestHook(src *pullRequestHook) *scm.PullRequestHook {
219219

220220
func convertPushHook(src *pushHook) *scm.PushHook {
221221
return &scm.PushHook{
222-
Ref: src.Sha,
222+
Ref: src.Ref.Name,
223223
Before: src.OldSha,
224224
After: src.Sha,
225225
Repo: convertRepo(src.Repo),

0 commit comments

Comments
 (0)