+1
Cargo.lock
+1
Cargo.lock
+1
Cargo.toml
+1
Cargo.toml
+18
-14
src/main.rs
+18
-14
src/main.rs
···
113
let json = serde_json::to_value(post)?;
114
let data = Data::from_json(&json)?;
115
116
-
println!("\nposting...");
117
client
118
.send(
119
CreateRecord::new()
···
240
.await?
241
.into_output()?,
242
);
243
-
println!("logged in as {} ({})", session.handle, session.did);
244
client.set_session(session).await?;
245
246
let slingshot_client = reqwest::Client::builder()
···
261
.connect_cursor(args.jetstream_cursor.map(Cursor::from_raw_u64))
262
.await?;
263
264
-
println!("receiving jetstream messages...");
265
loop {
266
let Some(event) = receiver.recv().await else {
267
-
eprintln!("consumer: could not receive event, bailing");
268
break;
269
};
270
···
277
if added.key
278
== "at://did:plc:wshs7t2adsemcrrd4snkeqli/sh.tangled.label.definition/good-first-issue"
279
{
280
-
println!("found a good first issue label!! {:?}", cursor);
281
added_good_first_issue = true;
282
break; // inner
283
}
284
-
eprintln!("found a label but it wasn't good-first-issue, ignoring...");
285
}
286
if !added_good_first_issue {
287
continue;
···
290
let IssueRecord { title, repo } = match get_record(&slingshot_client, &subject).await {
291
Ok(m) => m,
292
Err(e) => {
293
-
eprintln!("failed to get issue record: {e} for {subject}");
294
continue;
295
}
296
};
297
298
let Ok(repo_uri) = AtUri::new(&repo) else {
299
-
eprintln!("failed to parse repo to aturi for {subject}");
300
continue;
301
};
302
303
let RepoRecord { name: repo_name } = match get_record(&slingshot_client, &repo).await {
304
Ok(m) => m,
305
Err(e) => {
306
-
eprintln!("failed to get repo record: {e} for {subject}");
307
continue;
308
}
309
};
···
312
AtIdentifier::Handle(h) => format!("@{h}"),
313
AtIdentifier::Did(did) => match get_handle(&slingshot_client, did.as_str()).await {
314
Err(e) => {
315
-
eprintln!("failed to get mini doc from repo identifier: {e} for {subject}");
316
continue;
317
}
318
Ok(None) => did.to_string(),
···
326
let issues_url = format!("https://tangled.org/{nice_tangled_repo_id}/{repo_name}/issues");
327
328
if args.dry_run {
329
-
println!("--dry-run, but would have posted:");
330
-
println!("good-first-issue label added for {repo_full_name} ({repo_url}):");
331
-
println!("> {title} ({issues_url})\n");
332
continue;
333
}
334
···
342
)
343
.await
344
{
345
-
eprintln!("failed to post for {subject}: {e}");
346
};
347
348
break;
···
113
let json = serde_json::to_value(post)?;
114
let data = Data::from_json(&json)?;
115
116
+
log::info!("\nposting...");
117
client
118
.send(
119
CreateRecord::new()
···
240
.await?
241
.into_output()?,
242
);
243
+
log::debug!("logged in as {} ({})", session.handle, session.did);
244
client.set_session(session).await?;
245
246
let slingshot_client = reqwest::Client::builder()
···
261
.connect_cursor(args.jetstream_cursor.map(Cursor::from_raw_u64))
262
.await?;
263
264
+
log::info!("receiving jetstream messages...");
265
loop {
266
let Some(event) = receiver.recv().await else {
267
+
log::error!("consumer: could not receive event, bailing");
268
break;
269
};
270
···
277
if added.key
278
== "at://did:plc:wshs7t2adsemcrrd4snkeqli/sh.tangled.label.definition/good-first-issue"
279
{
280
+
log::info!("found a good first issue label!! {:?}", cursor);
281
added_good_first_issue = true;
282
break; // inner
283
}
284
+
log::debug!("found a label but it wasn't good-first-issue, ignoring...");
285
}
286
if !added_good_first_issue {
287
continue;
···
290
let IssueRecord { title, repo } = match get_record(&slingshot_client, &subject).await {
291
Ok(m) => m,
292
Err(e) => {
293
+
log::warn!("failed to get issue record: {e} for {subject}");
294
continue;
295
}
296
};
297
298
let Ok(repo_uri) = AtUri::new(&repo) else {
299
+
log::warn!("failed to parse repo to aturi for {subject}");
300
continue;
301
};
302
303
let RepoRecord { name: repo_name } = match get_record(&slingshot_client, &repo).await {
304
Ok(m) => m,
305
Err(e) => {
306
+
log::warn!("failed to get repo record: {e} for {subject}");
307
continue;
308
}
309
};
···
312
AtIdentifier::Handle(h) => format!("@{h}"),
313
AtIdentifier::Did(did) => match get_handle(&slingshot_client, did.as_str()).await {
314
Err(e) => {
315
+
log::warn!("failed to get mini doc from repo identifier: {e} for {subject}");
316
continue;
317
}
318
Ok(None) => did.to_string(),
···
326
let issues_url = format!("https://tangled.org/{nice_tangled_repo_id}/{repo_name}/issues");
327
328
if args.dry_run {
329
+
log::info!(
330
+
r#"--dry-run, but would have posted:
331
+
332
+
good-first-issue label added for {repo_full_name} ({repo_url}):
333
+
334
+
> {title} ({issues_url})"#
335
+
);
336
continue;
337
}
338
···
346
)
347
.await
348
{
349
+
log::error!("failed to post for {subject}: {e}");
350
};
351
352
break;