@@ -231,6 +231,16 @@ pub struct Label {
231
231
pub name : String ,
232
232
}
233
233
234
+ /// An indicator used to differentiate between an issue and a pull request.
235
+ ///
236
+ /// Some webhook events include a `pull_request` field in the Issue object,
237
+ /// and some don't. GitHub does include a few fields here, but they aren't
238
+ /// needed at this time (merged_at, diff_url, html_url, patch_url, url).
239
+ #[ derive( Debug , serde:: Deserialize ) ]
240
+ pub struct PullRequestDetails {
241
+ // none for now
242
+ }
243
+
234
244
/// An issue or pull request.
235
245
///
236
246
/// For convenience, since issues and pull requests share most of their
@@ -259,16 +269,12 @@ pub struct Issue {
259
269
pub user : User ,
260
270
pub labels : Vec < Label > ,
261
271
pub assignees : Vec < User > ,
262
- /// This is true if this is a pull request.
263
- ///
264
- /// Note that this field does not come from GitHub. This is manually added
265
- /// when the webhook arrives to help differentiate between an event
266
- /// related to an issue versus a pull request.
272
+ /// Indicator if this is a pull request.
267
273
///
268
- /// GitHub *does* actually populate this field on some events, but triagebot ignores that data
269
- /// and just stores a bool here when appropriate.
270
- # [ serde ( skip ) ]
271
- pub pull_request : bool ,
274
+ /// This is `Some` if this is a PR (as opposed to an issue). Note that
275
+ /// this does not always get filled in by GitHub, and must be manually
276
+ /// populated (because some webhook events do not set it).
277
+ pub pull_request : Option < PullRequestDetails > ,
272
278
/// Whether or not the pull request was merged.
273
279
#[ serde( default ) ]
274
280
pub merged : bool ,
@@ -458,7 +464,7 @@ impl Issue {
458
464
}
459
465
460
466
pub fn is_pr ( & self ) -> bool {
461
- self . pull_request
467
+ self . pull_request . is_some ( )
462
468
}
463
469
464
470
pub async fn get_comment ( & self , client : & GithubClient , id : usize ) -> anyhow:: Result < Comment > {
0 commit comments