-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support more events in webhook parse in go-scm for gitness (#289)
- Loading branch information
1 parent
e960969
commit e6556d1
Showing
6 changed files
with
271 additions
and
1 deletion.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
scm/driver/harness/testdata/webhooks/pull_request_closed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"trigger": "pullreq_closed", | ||
"repo": { | ||
"id": 22, | ||
"path": "codeowners/asdsad", | ||
"uid": "asdsad", | ||
"default_branch": "main", | ||
"git_url": "http://localhost:3000/git/codeowners/asdsad.git" | ||
}, | ||
"principal": { | ||
"id": 3, | ||
"uid": "admin", | ||
"display_name": "Administrator", | ||
"email": "admin@gitness.io", | ||
"type": "user", | ||
"created": 1696332021613, | ||
"updated": 1696332021613 | ||
}, | ||
"pull_req": { | ||
"number": 6, | ||
"state": "closed", | ||
"is_draft": false, | ||
"title": "Create sad", | ||
"source_repo_id": 22, | ||
"source_branch": "asdxsa", | ||
"target_repo_id": 22, | ||
"target_branch": "main", | ||
"author": { | ||
"id": 3, | ||
"uid": "admin", | ||
"display_name": "Administrator", | ||
"email": "admin@gitness.io", | ||
"type": "user", | ||
"created": 1696332021613, | ||
"updated": 1696332021613 | ||
} | ||
}, | ||
"target_ref": { | ||
"name": "refs/heads/main", | ||
"repo": { | ||
"id": 22, | ||
"path": "codeowners/asdsad", | ||
"uid": "asdsad", | ||
"default_branch": "main", | ||
"git_url": "http://localhost:3000/git/codeowners/asdsad.git" | ||
} | ||
}, | ||
"ref": { | ||
"name": "refs/heads/asdxsa", | ||
"repo": { | ||
"id": 22, | ||
"path": "codeowners/asdsad", | ||
"uid": "asdsad", | ||
"default_branch": "main", | ||
"git_url": "http://localhost:3000/git/codeowners/asdsad.git" | ||
} | ||
}, | ||
"sha": "27822dd2ec788f924c97b0b194c5bfd906f2e574", | ||
"commit": { | ||
"sha": "27822dd2ec788f924c97b0b194c5bfd906f2e574", | ||
"message": "", | ||
"author": { | ||
"identity": { | ||
"name": "Administrator", | ||
"email": "admin@gitness.io" | ||
}, | ||
"when": "2023-12-20T13:10:47+05:30" | ||
}, | ||
"committer": { | ||
"identity": { | ||
"name": "Gitness", | ||
"email": "system@gitness.io" | ||
}, | ||
"when": "2023-12-20T13:10:47+05:30" | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
scm/driver/harness/testdata/webhooks/pull_request_closed.json.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"Action": "closed", | ||
"Repo": { | ||
"ID": "22", | ||
"Namespace": "", | ||
"Name": "asdsad", | ||
"Branch": "main", | ||
"Private": false, | ||
"Clone": "http://localhost:3000/git/codeowners/asdsad.git", | ||
"CloneSSH": "", | ||
"Link": "http://localhost:3000/git/codeowners/asdsad.git", | ||
"Created": "0001-01-01T00:00:00Z", | ||
"Updated": "0001-01-01T00:00:00Z" | ||
}, | ||
"PullRequest": { | ||
"Number": 6, | ||
"Title": "Create sad", | ||
"Body": "", | ||
"Sha": "27822dd2ec788f924c97b0b194c5bfd906f2e574", | ||
"Ref": "refs/heads/asdxsa", | ||
"Source": "asdxsa", | ||
"Target": "main", | ||
"Fork": "fork", | ||
"Link": "http://localhost:3000/git/codeowners/asdsad.git", | ||
"Closed": true, | ||
"Merged": false, | ||
"Author": { | ||
"ID": "admin", | ||
"Login": "admin", | ||
"Name": "Administrator", | ||
"Email": "admin@gitness.io", | ||
"Avatar": "", | ||
"Created": "2023-10-03T16:50:21.613+05:30", | ||
"Updated": "2023-10-03T16:50:21.613+05:30" | ||
}, | ||
"Created": "0001-01-01T00:00:00Z", | ||
"Updated": "0001-01-01T00:00:00Z" | ||
}, | ||
"Sender": { | ||
"ID": "admin", | ||
"Login": "admin", | ||
"Name": "Administrator", | ||
"Email": "admin@gitness.io", | ||
"Avatar": "", | ||
"Created": "2023-10-03T16:50:21.613+05:30", | ||
"Updated": "2023-10-03T16:50:21.613+05:30" | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
scm/driver/harness/testdata/webhooks/pull_request_merged.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"trigger": "pullreq_merged", | ||
"repo": { | ||
"id": 22, | ||
"path": "codeowners/asdsad", | ||
"uid": "asdsad", | ||
"default_branch": "main", | ||
"git_url": "http://localhost:3000/git/codeowners/asdsad.git" | ||
}, | ||
"principal": { | ||
"id": 3, | ||
"uid": "admin", | ||
"display_name": "Administrator", | ||
"email": "admin@gitness.io", | ||
"type": "user", | ||
"created": 1696332021613, | ||
"updated": 1696332021613 | ||
}, | ||
"pull_req": { | ||
"number": 10, | ||
"state": "merged", | ||
"is_draft": false, | ||
"title": "Create xxasc", | ||
"source_repo_id": 22, | ||
"source_branch": "xas", | ||
"target_repo_id": 22, | ||
"target_branch": "main", | ||
"merge_strategy": "squash", | ||
"author": { | ||
"id": 3, | ||
"uid": "admin", | ||
"display_name": "Administrator", | ||
"email": "admin@gitness.io", | ||
"type": "user", | ||
"created": 1696332021613, | ||
"updated": 1696332021613 | ||
} | ||
}, | ||
"target_ref": { | ||
"name": "refs/heads/main", | ||
"repo": { | ||
"id": 22, | ||
"path": "codeowners/asdsad", | ||
"uid": "asdsad", | ||
"default_branch": "main", | ||
"git_url": "http://localhost:3000/git/codeowners/asdsad.git" | ||
} | ||
}, | ||
"ref": { | ||
"name": "refs/heads/xas", | ||
"repo": { | ||
"id": 22, | ||
"path": "codeowners/asdsad", | ||
"uid": "asdsad", | ||
"default_branch": "main", | ||
"git_url": "http://localhost:3000/git/codeowners/asdsad.git" | ||
} | ||
}, | ||
"sha": "4ec41187008f77222a60dfa21cdbd980f6490443", | ||
"commit": { | ||
"sha": "4ec41187008f77222a60dfa21cdbd980f6490443", | ||
"message": "", | ||
"author": { | ||
"identity": { | ||
"name": "Administrator", | ||
"email": "admin@gitness.io" | ||
}, | ||
"when": "2023-12-20T13:40:52+05:30" | ||
}, | ||
"committer": { | ||
"identity": { | ||
"name": "Gitness", | ||
"email": "system@gitness.io" | ||
}, | ||
"when": "2023-12-20T13:40:52+05:30" | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
scm/driver/harness/testdata/webhooks/pull_request_merged.json.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"Action": "merged", | ||
"Repo": { | ||
"ID": "22", | ||
"Namespace": "", | ||
"Name": "asdsad", | ||
"Branch": "main", | ||
"Private": false, | ||
"Clone": "http://localhost:3000/git/codeowners/asdsad.git", | ||
"CloneSSH": "", | ||
"Link": "http://localhost:3000/git/codeowners/asdsad.git", | ||
"Created": "0001-01-01T00:00:00Z", | ||
"Updated": "0001-01-01T00:00:00Z" | ||
}, | ||
"PullRequest": { | ||
"Number": 10, | ||
"Title": "Create xxasc", | ||
"Body": "", | ||
"Sha": "4ec41187008f77222a60dfa21cdbd980f6490443", | ||
"Ref": "refs/heads/xas", | ||
"Source": "xas", | ||
"Target": "main", | ||
"Fork": "fork", | ||
"Link": "http://localhost:3000/git/codeowners/asdsad.git", | ||
"Closed": true, | ||
"Merged": true, | ||
"Author": { | ||
"ID": "admin", | ||
"Login": "admin", | ||
"Name": "Administrator", | ||
"Email": "admin@gitness.io", | ||
"Avatar": "", | ||
"Created": "2023-10-03T16:50:21.613+05:30", | ||
"Updated": "2023-10-03T16:50:21.613+05:30" | ||
}, | ||
"Created": "0001-01-01T00:00:00Z", | ||
"Updated": "0001-01-01T00:00:00Z" | ||
}, | ||
"Sender": { | ||
"ID": "admin", | ||
"Login": "admin", | ||
"Name": "Administrator", | ||
"Email": "admin@gitness.io", | ||
"Avatar": "", | ||
"Created": "2023-10-03T16:50:21.613+05:30", | ||
"Updated": "2023-10-03T16:50:21.613+05:30" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters