Helper to create a GitHub check run and return the check_run_id
(
conn: &mut diesel_async::AsyncPgConnection,
app_state: &crate::config::AppState,
job: &crate::job::model::Job,
commit: &GitHubCommit,
)
| 559 | |
| 560 | /// Helper to create a GitHub check run and return the check_run_id |
| 561 | async fn create_github_check_run( |
| 562 | conn: &mut diesel_async::AsyncPgConnection, |
| 563 | app_state: &crate::config::AppState, |
| 564 | job: &crate::job::model::Job, |
| 565 | commit: &GitHubCommit, |
| 566 | ) -> Result<i64> { |
| 567 | // Get repo and owner |
| 568 | let repo: GitHubRepo = github_repo::table |
| 569 | .filter(github_repo::id.eq(commit.repo_id)) |
| 570 | .select(GitHubRepo::as_select()) |
| 571 | .first(conn) |
| 572 | .await?; |
| 573 | let owner: GithubOwner = github_owner::table |
| 574 | .filter(github_owner::id.eq(repo.owner_id)) |
| 575 | .select(GithubOwner::as_select()) |
| 576 | .first(conn) |
| 577 | .await?; |
| 578 | |
| 579 | // Get installation client |
| 580 | let installation = GithubInstallation::get_for_owner_id(conn, owner.id).await?; |
| 581 | let github_client = GitHubApiClient::for_installation(app_state, installation.id)?; |
| 582 | |
| 583 | // Create check run via integration layer |
| 584 | let check_run_id = github_client |
| 585 | .create_check_run(CreateCheckRunParams { |
| 586 | owner_login: &owner.login, |
| 587 | repo_name: &repo.name, |
| 588 | job_id: job.id, |
| 589 | job_platform: &job.platform.to_string(), |
| 590 | rev: &commit.rev, |
| 591 | base_url: app_state.config.base_url.as_str(), |
| 592 | }) |
| 593 | .await?; |
| 594 | |
| 595 | Ok(check_run_id) |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | #[async_trait] |
nothing calls this directly
no test coverage detected