Skip to content

Commit 730b70f

Browse files
authored
Remove fields deleted in October 2025 API changes (#826)
* Remove deleted fields from PushEventPayload These were removed from the GitHub API on 7 October 2025[1]. Since then, trying to load repository events using Octocrab will fail: called `Result::unwrap()` on an `Err` value: Error("missing field `size`", line: 0, column: 0) Link: https://github.blog/changelog/2025-08-08-upcoming-changes-to-github-events-api-payloads/ [1] * Make author_association optional on comments Since 7 October 2025, GitHub no longer returns this field in the Activity Events API. Link: https://github.blog/changelog/2025-08-08-upcoming-changes-to-github-events-api-payloads/ * Update pull_request_event fixture to remove obsolete fields These have not been returned by the GitHub API since 7 October 2025. Link: https://github.blog/changelog/2025-08-08-upcoming-changes-to-github-events-api-payloads/
1 parent 8cecdae commit 730b70f

File tree

10 files changed

+10
-357
lines changed

10 files changed

+10
-357
lines changed

src/models/events/payload/push.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ use crate::models::PushId;
88
#[non_exhaustive]
99
pub struct PushEventPayload {
1010
pub push_id: PushId,
11-
pub size: u64,
12-
pub distinct_size: u64,
1311
pub r#ref: String,
1412
pub head: String,
1513
pub before: String,
16-
pub commits: Vec<Commit>,
1714
}
1815

1916
#[cfg(test)]
@@ -33,28 +30,9 @@ mod test {
3330
match payload {
3431
EventPayload::PushEvent(payload) => {
3532
assert_eq!(payload.push_id.0, 6080608029);
36-
assert_eq!(payload.size, 1);
37-
assert_eq!(payload.distinct_size, 1);
3833
assert_eq!(payload.r#ref, "refs/heads/master");
3934
assert_eq!(payload.head, "eb1a60c03544dcea290f2d57bb66ae188ce25778");
4035
assert_eq!(payload.before, "9b2afb3a8e03fb30cc09e5efb64823bde802cf59");
41-
assert_eq!(payload.commits.len(), 1);
42-
let commit = payload.commits.first().unwrap();
43-
assert_eq!(commit.sha, "eb1a60c03544dcea290f2d57bb66ae188ce25778");
44-
assert_eq!(
45-
commit.author,
46-
CommitAuthor {
47-
name: "readme-bot".to_string(),
48-
email: Some("readme-bot@example.com".to_string()),
49-
date: None,
50-
}
51-
);
52-
assert_eq!(commit.message, "Charts Updated");
53-
assert!(commit.distinct);
54-
assert_eq!(
55-
commit.url,
56-
Url::parse("https://api.github.com/repos/user/user/commits/12345").unwrap()
57-
);
5836
}
5937
_ => panic!("unexpected event deserialized"),
6038
}

src/models/issues.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ pub struct Comment {
5858
pub body_text: Option<String>,
5959
#[serde(skip_serializing_if = "Option::is_none")]
6060
pub body_html: Option<String>,
61-
pub author_association: AuthorAssociation,
61+
#[serde(skip_serializing_if = "Option::is_none")]
62+
pub author_association: Option<AuthorAssociation>,
6263
pub user: Author,
6364
pub created_at: chrono::DateTime<chrono::Utc>,
6465
#[serde(skip_serializing_if = "Option::is_none")]

src/models/pulls.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ pub struct Comment {
279279
pub created_at: chrono::DateTime<chrono::Utc>,
280280
pub updated_at: chrono::DateTime<chrono::Utc>,
281281
pub html_url: String,
282-
pub author_association: AuthorAssociation,
282+
#[serde(skip_serializing_if = "Option::is_none")]
283+
pub author_association: Option<AuthorAssociation>,
283284
#[serde(rename = "_links")]
284285
pub links: Links,
285286
pub start_line: Option<u64>,
@@ -312,7 +313,8 @@ pub struct ReviewComment {
312313
pub updated_at: chrono::DateTime<chrono::Utc>,
313314
pub html_url: String,
314315
pub pull_request_url: String,
315-
pub author_association: AuthorAssociation,
316+
#[serde(skip_serializing_if = "Option::is_none")]
317+
pub author_association: Option<AuthorAssociation>,
316318
#[serde(rename = "_links")]
317319
pub links: Links,
318320
#[serde(skip_serializing_if = "Option::is_none")]

tests/resources/commit_comment_event.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"commit_id": "d287fa985a6501fe8cbda3957e10949512c5d4c6",
4747
"created_at": "2021-01-26T11:17:08Z",
4848
"updated_at": "2021-01-26T11:17:08Z",
49-
"author_association": "OWNER",
5049
"body": "Commit comment?"
5150
}
5251
},

tests/resources/issue_comment_event.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
"created_at": "2021-01-14T13:18:48Z",
6868
"updated_at": "2021-01-14T13:41:43Z",
6969
"closed_at": null,
70-
"author_association": "OWNER",
7170
"active_lock_reason": null,
7271
"body": "",
7372
"performed_via_github_app": null
@@ -100,7 +99,6 @@
10099
},
101100
"created_at": "2021-01-14T13:41:43Z",
102101
"updated_at": "2021-01-14T13:41:43Z",
103-
"author_association": "OWNER",
104102
"body": "Test",
105103
"performed_via_github_app": null
106104
}

tests/resources/pull_request_event.json

Lines changed: 3 additions & 309 deletions
Large diffs are not rendered by default.

tests/resources/pull_request_review_comment.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"updated_at": "2011-04-14T16:00:49Z",
3636
"html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
3737
"pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
38-
"author_association": "NONE",
3938
"_links": {
4039
"self": {
4140
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"

tests/resources/pull_request_review_comment_event.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"updated_at": "2021-01-20T13:55:24Z",
5353
"html_url": "https://github.com/wayofthepie/test-events/pull/8#discussion_r560976245",
5454
"pull_request_url": "https://api.github.com/repos/wayofthepie/test-events/pulls/8",
55-
"author_association": "OWNER",
5655
"_links": {
5756
"self": {
5857
"href": "https://api.github.com/repos/wayofthepie/test-events/pulls/comments/560976245"
@@ -425,7 +424,6 @@
425424
"href": "https://api.github.com/repos/wayofthepie/test-events/statuses/cd166a61872f51c708a595244692729f82753f8c"
426425
}
427426
},
428-
"author_association": "OWNER",
429427
"active_lock_reason": null
430428
}
431429
},

tests/resources/pull_request_review_event.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"state": "approved",
4646
"html_url": "https://github.com/LizardByte/RetroArcher/pull/218#pullrequestreview-1294651480",
4747
"pull_request_url": "https://api.github.com/repos/LizardByte/RetroArcher/pulls/218",
48-
"author_association": "NONE",
4948
"_links": {
5049
"html": {
5150
"href": "https://github.com/LizardByte/RetroArcher/pull/218#pullrequestreview-1294651480"
@@ -440,7 +439,6 @@
440439
"href": "https://api.github.com/repos/LizardByte/RetroArcher/statuses/95da334b60ad7e4fff86806705d5c2909c0c7411"
441440
}
442441
},
443-
"author_association": "MEMBER",
444442
"auto_merge": null,
445443
"active_lock_reason": null
446444
}

tests/resources/push_event.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,9 @@
1616
},
1717
"payload": {
1818
"push_id": 6080608029,
19-
"size": 1,
20-
"distinct_size": 1,
2119
"ref": "refs/heads/master",
2220
"head": "eb1a60c03544dcea290f2d57bb66ae188ce25778",
23-
"before": "9b2afb3a8e03fb30cc09e5efb64823bde802cf59",
24-
"commits": [
25-
{
26-
"sha": "eb1a60c03544dcea290f2d57bb66ae188ce25778",
27-
"author": {
28-
"email": "readme-bot@example.com",
29-
"name": "readme-bot"
30-
},
31-
"message": "Charts Updated",
32-
"distinct": true,
33-
"url": "https://api.github.com/repos/user/user/commits/12345"
34-
}
35-
]
21+
"before": "9b2afb3a8e03fb30cc09e5efb64823bde802cf59"
3622
},
3723
"public": true,
3824
"created_at": "2020-11-23T19:54:09Z"

0 commit comments

Comments
 (0)