(
&self,
repo: BevyRepo,
issue_title: &str,
issue_body: &str,
labels: Vec<&str>,
)
| 336 | /// See [the Github API documentation](https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#create-an-issue) for more information. |
| 337 | #[allow(clippy::result_large_err)] |
| 338 | pub fn open_issue( |
| 339 | &self, |
| 340 | repo: BevyRepo, |
| 341 | issue_title: &str, |
| 342 | issue_body: &str, |
| 343 | labels: Vec<&str>, |
| 344 | ) -> Result<GithubIssueOpenedResponse, IssueError> { |
| 345 | let response = self |
| 346 | .agent |
| 347 | .post(&format!( |
| 348 | "https://api.github.com/repos/bevyengine/{repo}/issues" |
| 349 | )) |
| 350 | .set("Authorization", &format!("Bearer {}", self.token)) |
| 351 | .set("Accept", "application/vnd.github+json") |
| 352 | .set("X-GitHub-Api-Version", "2022-11-28") |
| 353 | .send_json(ureq::json!({ |
| 354 | "title": issue_title, |
| 355 | "body": issue_body, |
| 356 | // TODO: add the milestone. Tracked in https://github.com/bevyengine/bevy-website/issues/1269 |
| 357 | // Note that this must be provided as an integer, so we'll have to look up the milestone ID. |
| 358 | "labels": labels, |
| 359 | }))?; |
| 360 | |
| 361 | // Make sure the issue was created successfully |
| 362 | if response.status() != 201 { |
| 363 | Err(IssueError::FailedToCreateIssue(response)) |
| 364 | } else { |
| 365 | let parsed_response: GithubIssueOpenedResponse = response.into_json()?; |
| 366 | |
| 367 | Ok(parsed_response) |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | /// Leaves a comment on the specified issue or pull request. |
| 372 | /// |
no outgoing calls
no test coverage detected