forgejo-hooks: merged_at attribute is optional
Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
parent
9d43e6085d
commit
9bcf1665a6
3 changed files with 503 additions and 1 deletions
|
|
@ -233,7 +233,7 @@ pub enum IssueState {
|
|||
#[derive(Deserialize, Debug, PartialEq)]
|
||||
pub struct PullRequestMeta {
|
||||
pub merged: bool,
|
||||
pub merged_at: DateTime<Utc>,
|
||||
pub merged_at: Option<DateTime<Utc>>,
|
||||
pub draft: bool,
|
||||
pub html_url: String,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,3 +79,12 @@ fn issue_commented() {
|
|||
let res: Issue = parse(&payload).unwrap();
|
||||
assert!(res.comment.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mr_commented() {
|
||||
let payload = std::fs::read_to_string("src/tests/mr-commented-13.0.1.json").unwrap();
|
||||
let _ = parse_roundtrip::<Issue>(&payload);
|
||||
|
||||
let res: Issue = parse(&payload).unwrap();
|
||||
assert!(res.comment.is_some());
|
||||
}
|
||||
|
|
|
|||
493
forgejo-hooks/src/tests/mr-commented-13.0.1.json
Normal file
493
forgejo-hooks/src/tests/mr-commented-13.0.1.json
Normal file
|
|
@ -0,0 +1,493 @@
|
|||
{
|
||||
"action": "created",
|
||||
"issue": {
|
||||
"id": 16,
|
||||
"url": "https://code.bouah.net/api/v1/repos/pep/webhook-test/issues/13",
|
||||
"html_url": "https://code.bouah.net/pep/webhook-test/pulls/13",
|
||||
"number": 13,
|
||||
"user": {
|
||||
"id": 1,
|
||||
"login": "pep",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "pep@bouah .net",
|
||||
"avatar_url": "https://code.bouah.net/avatars/84a4a0c29e85d7ab24dda43236d606ec5825fbf5b173c056b0c8bfbd3855cfd1",
|
||||
"html_url": "https://code.bouah.net/pep",
|
||||
"language": "en-US",
|
||||
"is_admin": true,
|
||||
"last_login": "2025-10-29T13:01:31Z",
|
||||
"created": "2023-01-02T21:57:48Z",
|
||||
"restricted": false,
|
||||
"active": true,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"pronouns": "",
|
||||
"website": "https://bouah.net",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "pep"
|
||||
},
|
||||
"original_author": "",
|
||||
"original_author_id": 0,
|
||||
"title": "meh",
|
||||
"body": "Signed-off-by: pep \\u003cpep@bouah.net\\u003e",
|
||||
"ref": "",
|
||||
"assets": [],
|
||||
"labels": [],
|
||||
"milestone": null,
|
||||
"assignee": null,
|
||||
"assignees": null,
|
||||
"state": "closed",
|
||||
"is_locked": false,
|
||||
"comments": 1,
|
||||
"created_at": "2025-05-03T16:36:03Z",
|
||||
"updated_at": "2025-10-29T14:10:42Z",
|
||||
"closed_at": "2025-05-03T16:37:00Z",
|
||||
"due_date": null,
|
||||
"pull_request": {
|
||||
"merged": false,
|
||||
"merged_at": null,
|
||||
"draft": false,
|
||||
"html_url": "https://code.bouah.net/pep/webhook-test/pulls/13"
|
||||
},
|
||||
"repository": {
|
||||
"id": 20,
|
||||
"name": "webhook-test",
|
||||
"owner": "pep",
|
||||
"full_name": "pep/webhook-test"
|
||||
},
|
||||
"pin_order": 0
|
||||
},
|
||||
"pull_request": {
|
||||
"id": 1,
|
||||
"url": "https://code.bouah.net/pep/webhook-test/pulls/13",
|
||||
"number": 13,
|
||||
"user": {
|
||||
"id": 1,
|
||||
"login": "pep",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "pep@bouah.net",
|
||||
"avatar_url": "https://code.bouah.net/avatars/84a4a0c29e85d7ab24dda43236d606ec5825fbf5b173c056b0c8bfbd3855cfd1",
|
||||
"html_url": "https://code.bouah.net/pep",
|
||||
"language": "en-US",
|
||||
"is_admin": true,
|
||||
"last_login": "2025-10-29T13:01:31Z",
|
||||
"created": "2023-01-02T21:57:48Z",
|
||||
"restricted": false,
|
||||
"active": true,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"pronouns": "",
|
||||
"website": "https://bouah.net",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "pep"
|
||||
},
|
||||
"title": "meh",
|
||||
"body": "Signed-off-by: pep \\u003cpep@bouah.net\\u003e",
|
||||
"labels": [],
|
||||
"milestone": null,
|
||||
"assignee": null,
|
||||
"assignees": null,
|
||||
"requested_reviewers": [],
|
||||
"requested_reviewers_teams": [],
|
||||
"state": "closed",
|
||||
"draft": false,
|
||||
"is_locked": false,
|
||||
"comments": 1,
|
||||
"review_comments": 0,
|
||||
"additions": 0,
|
||||
"deletions": 1,
|
||||
"changed_files": 1,
|
||||
"html_url": "https://code.bouah.net/pep/webhook-test/pulls/13",
|
||||
"diff_url": "https://code.bouah.net/pep/webhook-test/pulls/13.diff",
|
||||
"patch_url": "https://code.bouah.net/pep/webhook-test/pulls/13.patch",
|
||||
"mergeable": true,
|
||||
"merged": false,
|
||||
"merged_at": null,
|
||||
"merge_commit_sha": null,
|
||||
"merged_by": null,
|
||||
"allow_maintainer_edit": false,
|
||||
"base": {
|
||||
"label": "main",
|
||||
"ref": "main",
|
||||
"sha": "e63245c222ee51c12d5376ecdeaaff6a08eee4c0",
|
||||
"repo_id": 20,
|
||||
"repo": {
|
||||
"id": 20,
|
||||
"owner": {
|
||||
"id": 1,
|
||||
"login": "pep",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "pep@bouah.net",
|
||||
"avatar_url": "https://code.bouah.net/avatars/84a4a0c29e85d7ab24dda43236d606ec5825fbf5b173c056b0c8bfbd3855cfd1",
|
||||
"html_url": "https://code.bouah.net/pep",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-01-02T21:57:48Z",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"pronouns": "",
|
||||
"website": "https://bouah.net",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "pep"
|
||||
},
|
||||
"name": "webhook-test",
|
||||
"full_name": "pep/webhook-test",
|
||||
"description": "",
|
||||
"empty": false,
|
||||
"private": true,
|
||||
"fork": false,
|
||||
"template": false,
|
||||
"parent": null,
|
||||
"mirror": false,
|
||||
"size": 35,
|
||||
"language": "",
|
||||
"languages_url": "https://code.bouah.net/api/v1/repos/pep/webhook-test/languages",
|
||||
"html_url": "https://code.bouah.net/pep/webhook-test",
|
||||
"url": "https://code.bouah.net/api/v1/repos/pep/webhook-test",
|
||||
"link": "",
|
||||
"ssh_url": "ssh://forgejo@code.bouah.net/pep/webhook-test.git",
|
||||
"clone_url": "https://code.bouah.net/pep/webhook-test.git",
|
||||
"original_url": "",
|
||||
"website": "",
|
||||
"stars_count": 0,
|
||||
"forks_count": 0,
|
||||
"watchers_count": 1,
|
||||
"open_issues_count": 12,
|
||||
"open_pr_counter": 0,
|
||||
"release_counter": 0,
|
||||
"default_branch": "main",
|
||||
"archived": false,
|
||||
"created_at": "2024-04-23T11:49:34Z",
|
||||
"updated_at": "2025-10-29T13:01:49Z",
|
||||
"archived_at": "1970-01-01T00:00:00Z",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"has_issues": true,
|
||||
"internal_tracker": {
|
||||
"enable_time_tracker": false,
|
||||
"allow_only_contributors_to_track_time": true,
|
||||
"enable_issue_dependencies": true
|
||||
},
|
||||
"has_wiki": true,
|
||||
"wiki_branch": "master",
|
||||
"globally_editable_wiki": false,
|
||||
"has_pull_requests": true,
|
||||
"has_projects": true,
|
||||
"has_releases": true,
|
||||
"has_packages": true,
|
||||
"has_actions": false,
|
||||
"ignore_whitespace_conflicts": false,
|
||||
"allow_merge_commits": true,
|
||||
"allow_rebase": true,
|
||||
"allow_rebase_explicit": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_fast_forward_only_merge": false,
|
||||
"allow_rebase_update": true,
|
||||
"default_delete_branch_after_merge": false,
|
||||
"default_merge_style": "rebase",
|
||||
"default_allow_maintainer_edit": false,
|
||||
"default_update_style": "merge",
|
||||
"avatar_url": "",
|
||||
"internal": false,
|
||||
"mirror_interval": "",
|
||||
"object_format_name": "sha1",
|
||||
"mirror_updated": "0001-01-01T00:00:00Z",
|
||||
"repo_transfer": null,
|
||||
"topics": []
|
||||
}
|
||||
},
|
||||
"head": {
|
||||
"label": "meh",
|
||||
"ref": "meh",
|
||||
"sha": "1320ad24085a4109505a899376315a708bd656c5",
|
||||
"repo_id": 20,
|
||||
"repo": {
|
||||
"id": 20,
|
||||
"owner": {
|
||||
"id": 1,
|
||||
"login": "pep",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "pep@bouah.net",
|
||||
"avatar_url": "https://code.bouah.net/avatars/84a4a0c29e85d7ab24dda43236d606ec5825fbf5b173c056b0c8bfbd3855cfd1",
|
||||
"html_url": "https://code.bouah.net/pep",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-01-02T21:57:48Z",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"pronouns": "",
|
||||
"website": "https://bouah.net",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "pep"
|
||||
},
|
||||
"name": "webhook-test",
|
||||
"full_name": "pep/webhook-test",
|
||||
"description": "",
|
||||
"empty": false,
|
||||
"private": true,
|
||||
"fork": false,
|
||||
"template": false,
|
||||
"parent": null,
|
||||
"mirror": false,
|
||||
"size": 35,
|
||||
"language": "",
|
||||
"languages_url": "https://code.bouah.net/api/v1/repos/pep/webhook-test/languages",
|
||||
"html_url": "https://code.bouah.net/pep/webhook-test",
|
||||
"url": "https://code.bouah.net/api/v1/repos/pep/webhook-test",
|
||||
"link": "",
|
||||
"ssh_url": "ssh://forgejo@code.bouah.net/pep/webhook-test.git",
|
||||
"clone_url": "https://code.bouah.net/pep/webhook-test.git",
|
||||
"original_url": "",
|
||||
"website": "",
|
||||
"stars_count": 0,
|
||||
"forks_count": 0,
|
||||
"watchers_count": 1,
|
||||
"open_issues_count": 12,
|
||||
"open_pr_counter": 0,
|
||||
"release_counter": 0,
|
||||
"default_branch": "main",
|
||||
"archived": false,
|
||||
"created_at": "2024-04-23T11:49:34Z",
|
||||
"updated_at": "2025-10-29T13:01:49Z",
|
||||
"archived_at": "1970-01-01T00:00:00Z",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"has_issues": true,
|
||||
"internal_tracker": {
|
||||
"enable_time_tracker": false,
|
||||
"allow_only_contributors_to_track_time": true,
|
||||
"enable_issue_dependencies": true
|
||||
},
|
||||
"has_wiki": true,
|
||||
"wiki_branch": "master",
|
||||
"globally_editable_wiki": false,
|
||||
"has_pull_requests": true,
|
||||
"has_projects": true,
|
||||
"has_releases": true,
|
||||
"has_packages": true,
|
||||
"has_actions": false,
|
||||
"ignore_whitespace_conflicts": false,
|
||||
"allow_merge_commits": true,
|
||||
"allow_rebase": true,
|
||||
"allow_rebase_explicit": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_fast_forward_only_merge": false,
|
||||
"allow_rebase_update": true,
|
||||
"default_delete_branch_after_merge": false,
|
||||
"default_merge_style": "rebase",
|
||||
"default_allow_maintainer_edit": false,
|
||||
"default_update_style": "merge",
|
||||
"avatar_url": "",
|
||||
"internal": false,
|
||||
"mirror_interval": "",
|
||||
"object_format_name": "sha1",
|
||||
"mirror_updated": "0001-01-01T00:00:00Z",
|
||||
"repo_transfer": null,
|
||||
"topics": []
|
||||
}
|
||||
},
|
||||
"merge_base": "e63245c222ee51c12d5376ecdeaaff6a08eee4c0",
|
||||
"due_date": null,
|
||||
"created_at": "2025-05-03T16:36:03Z",
|
||||
"updated_at": "2025-10-29T14:10:42Z",
|
||||
"closed_at": "2025-05-03T16:37:00Z",
|
||||
"pin_order": 0,
|
||||
"flow": 0
|
||||
},
|
||||
"comment": {
|
||||
"id": 6207,
|
||||
"html_url": "https://code.bouah.net/pep/webhook-test/pulls/13#issuecomment-6207",
|
||||
"pull_request_url": "https://code.bouah.net/pep/webhook-test/pulls/13",
|
||||
"issue_url": "",
|
||||
"user": {
|
||||
"id": 1,
|
||||
"login": "pep",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "pep@forgejo-noreply",
|
||||
"avatar_url": "https://code.bouah.net/avatars/84a4a0c29e85d7ab24dda43236d606ec5825fbf5b173c056b0c8bfbd3855cfd1",
|
||||
"html_url": "https://code.bouah.net/pep",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-01-02T21:57:48Z",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"pronouns": "",
|
||||
"website": "https://bouah.net",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "pep"
|
||||
},
|
||||
"original_author": "",
|
||||
"original_author_id": 0,
|
||||
"body": "..",
|
||||
"assets": [],
|
||||
"created_at": "2025-10-29T14:10:42Z",
|
||||
"updated_at": "2025-10-29T14:10:42Z"
|
||||
},
|
||||
"repository": {
|
||||
"id": 20,
|
||||
"owner": {
|
||||
"id": 1,
|
||||
"login": "pep",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "pep@bouah.net",
|
||||
"avatar_url": "https://code.bouah.net/avatars/84a4a0c29e85d7ab24dda43236d606ec5825fbf5b173c056b0c8bfbd3855cfd1",
|
||||
"html_url": "https://code.bouah.net/pep",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-01-02T21:57:48Z",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"pronouns": "",
|
||||
"website": "https://bouah.net",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "pep"
|
||||
},
|
||||
"name": "webhook-test",
|
||||
"full_name": "pep/webhook-test",
|
||||
"description": "",
|
||||
"empty": false,
|
||||
"private": true,
|
||||
"fork": false,
|
||||
"template": false,
|
||||
"parent": null,
|
||||
"mirror": false,
|
||||
"size": 35,
|
||||
"language": "",
|
||||
"languages_url": "https://code.bouah.net/api/v1/repos/pep/webhook-test/languages",
|
||||
"html_url": "https://code.bouah.net/pep/webhook-test",
|
||||
"url": "https://code.bouah.net/api/v1/repos/pep/webhook-test",
|
||||
"link": "",
|
||||
"ssh_url": "ssh://forgejo@code.bouah.net/pep/webhook-test.git",
|
||||
"clone_url": "https://code.bouah.net/pep/webhook-test.git",
|
||||
"original_url": "",
|
||||
"website": "",
|
||||
"stars_count": 0,
|
||||
"forks_count": 0,
|
||||
"watchers_count": 1,
|
||||
"open_issues_count": 12,
|
||||
"open_pr_counter": 0,
|
||||
"release_counter": 0,
|
||||
"default_branch": "main",
|
||||
"archived": false,
|
||||
"created_at": "2024-04-23T11:49:34Z",
|
||||
"updated_at": "2025-10-29T13:01:49Z",
|
||||
"archived_at": "1970-01-01T00:00:00Z",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"has_issues": true,
|
||||
"internal_tracker": {
|
||||
"enable_time_tracker": false,
|
||||
"allow_only_contributors_to_track_time": true,
|
||||
"enable_issue_dependencies": true
|
||||
},
|
||||
"has_wiki": true,
|
||||
"wiki_branch": "master",
|
||||
"globally_editable_wiki": false,
|
||||
"has_pull_requests": true,
|
||||
"has_projects": true,
|
||||
"has_releases": true,
|
||||
"has_packages": true,
|
||||
"has_actions": false,
|
||||
"ignore_whitespace_conflicts": false,
|
||||
"allow_merge_commits": true,
|
||||
"allow_rebase": true,
|
||||
"allow_rebase_explicit": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_fast_forward_only_merge": false,
|
||||
"allow_rebase_update": true,
|
||||
"default_delete_branch_after_merge": false,
|
||||
"default_merge_style": "rebase",
|
||||
"default_allow_maintainer_edit": false,
|
||||
"default_update_style": "merge",
|
||||
"avatar_url": "",
|
||||
"internal": false,
|
||||
"mirror_interval": "",
|
||||
"object_format_name": "sha1",
|
||||
"mirror_updated": "0001-01-01T00:00:00Z",
|
||||
"repo_transfer": null,
|
||||
"topics": []
|
||||
},
|
||||
"sender": {
|
||||
"id": 1,
|
||||
"login": "pep",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "pep@forgejo-noreply",
|
||||
"avatar_url": "https://code.bouah.net/avatars/84a4a0c29e85d7ab24dda43236d606ec5825fbf5b173c056b0c8bfbd3855cfd1",
|
||||
"html_url": "https://code.bouah.net/pep",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-01-02T21:57:48Z",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"pronouns": "",
|
||||
"website": "https://bouah.net",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "pep"
|
||||
},
|
||||
"is_pull": true
|
||||
}
|
||||
Loading…
Reference in a new issue