Skip to content

Commit 35a3ea9

Browse files
Merge pull request #1673 from ehuss/docs-update
Automate documentation updates for rust-lang/rust
2 parents 987ad86 + 4384fc3 commit 35a3ea9

File tree

7 files changed

+735
-5
lines changed

7 files changed

+735
-5
lines changed

github-graphql/src/lib.rs

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! See <https://docs.github.com/en/graphql> for more GitHub's GraphQL API.
44
5-
// This schema can be downloaded from https://docs.github.com/en/graphql/overview/public-schema
5+
// This schema can be downloaded from https://docs.github.com/public/schema.docs.graphql
66
#[cynic::schema_for_derives(file = "src/github.graphql", module = "schema")]
77
pub mod queries {
88
use super::schema;
@@ -155,6 +155,113 @@ pub mod queries {
155155
pub struct Uri(pub String);
156156
}
157157

158+
#[cynic::schema_for_derives(file = "src/github.graphql", module = "schema")]
159+
pub mod docs_update_queries {
160+
use super::queries::{DateTime, PageInfo};
161+
use super::schema;
162+
163+
#[derive(cynic::FragmentArguments, Debug)]
164+
pub struct RecentCommitsArguments {
165+
pub branch: String,
166+
pub name: String,
167+
pub owner: String,
168+
pub after: Option<String>,
169+
}
170+
171+
#[derive(cynic::QueryFragment, Debug)]
172+
#[cynic(graphql_type = "Query", argument_struct = "RecentCommitsArguments")]
173+
pub struct RecentCommits {
174+
#[arguments(name = &args.name, owner = &args.owner)]
175+
pub repository: Option<Repository>,
176+
}
177+
178+
#[derive(cynic::QueryFragment, Debug)]
179+
#[cynic(argument_struct = "RecentCommitsArguments")]
180+
pub struct Repository {
181+
#[arguments(qualified_name = &args.branch)]
182+
#[cynic(rename = "ref")]
183+
pub ref_: Option<Ref>,
184+
}
185+
186+
#[derive(cynic::QueryFragment, Debug)]
187+
pub struct Ref {
188+
pub target: Option<GitObject>,
189+
}
190+
191+
#[derive(cynic::QueryFragment, Debug)]
192+
pub struct Commit {
193+
#[arguments(first = 100)]
194+
pub history: CommitHistoryConnection,
195+
}
196+
197+
#[derive(cynic::QueryFragment, Debug)]
198+
pub struct CommitHistoryConnection {
199+
pub total_count: i32,
200+
pub page_info: PageInfo,
201+
pub nodes: Option<Vec<Option<Commit2>>>,
202+
}
203+
204+
#[derive(cynic::QueryFragment, Debug)]
205+
#[cynic(graphql_type = "Commit")]
206+
pub struct Commit2 {
207+
pub oid: GitObjectID,
208+
#[arguments(first = 1)]
209+
pub parents: CommitConnection,
210+
pub committed_date: DateTime,
211+
pub message_headline: String,
212+
#[arguments(first = 1)]
213+
pub associated_pull_requests: Option<PullRequestConnection>,
214+
}
215+
216+
#[derive(cynic::QueryFragment, Debug)]
217+
pub struct PullRequestConnection {
218+
pub nodes: Option<Vec<Option<PullRequest>>>,
219+
}
220+
221+
#[derive(cynic::QueryFragment, Debug)]
222+
pub struct PullRequest {
223+
pub number: i32,
224+
pub title: String,
225+
}
226+
227+
#[derive(cynic::QueryFragment, Debug)]
228+
pub struct CommitConnection {
229+
pub nodes: Option<Vec<Option<Commit3>>>,
230+
}
231+
232+
#[derive(cynic::QueryFragment, Debug)]
233+
#[cynic(graphql_type = "Commit")]
234+
pub struct Commit3 {
235+
pub oid: GitObjectID,
236+
}
237+
238+
#[derive(cynic::InlineFragments, Debug)]
239+
pub enum GitObject {
240+
Commit(Commit),
241+
// These three variants are here just to pacify cynic. I don't know
242+
// why it fails to compile without them.
243+
Tree(Tree),
244+
Tag(Tag),
245+
Blob(Blob),
246+
}
247+
248+
#[derive(cynic::QueryFragment, Debug)]
249+
pub struct Tree {
250+
pub id: cynic::Id,
251+
}
252+
#[derive(cynic::QueryFragment, Debug)]
253+
pub struct Tag {
254+
pub id: cynic::Id,
255+
}
256+
#[derive(cynic::QueryFragment, Debug)]
257+
pub struct Blob {
258+
pub id: cynic::Id,
259+
}
260+
261+
#[derive(cynic::Scalar, Debug, Clone)]
262+
pub struct GitObjectID(pub String);
263+
}
264+
158265
mod schema {
159266
cynic::use_schema!("src/github.graphql");
160267
}

src/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub async fn run_scheduled_jobs(db: &DbClient) -> anyhow::Result<()> {
211211
delete_job(&db, &job.id).await?;
212212
}
213213
Err(e) => {
214-
tracing::trace!("job failed on execution (id={:?}, error={:?})", job.id, e);
214+
tracing::error!("job failed on execution (id={:?}, error={:?})", job.id, e);
215215
update_job_error_message(&db, &job.id, &e.to_string()).await?;
216216
}
217217
}

0 commit comments

Comments
 (0)