MCPcopy Create free account
hub / github.com/bytecodealliance/wstd / verify_crates_io

Function verify_crates_io

ci/publish.rs:390–428  ·  view source on GitHub ↗
(krate: &Crate)

Source from the content-addressed store, hash-verified

388 }
389
390 fn verify_crates_io(krate: &Crate) {
391 let name = &krate.name;
392 let Some(owners) = curl(&format!("https://crates.io/api/v1/crates/{name}/owners")) else {
393 panic!(
394 "
395failed to get owners for {name}
396
397If this crate does not exist on crates.io yet please ping wstd maintainers
398to add the crate on crates.io as a small shim. When doing so please remind them
399that the trusted publishing workflow must be configured as well.
400",
401 name = name,
402 );
403 };
404
405 // This is the id of the `wasmtime-publish` user on crates.io
406 if !owners.contains("\"id\":73222,") {
407 panic!(
408 "
409crate {name} is not owned by wasmtime-publish, please run:
410
411 cargo owner -a wasmtime-publish {name}
412",
413 name = name,
414 );
415 }
416
417 if owners.split("\"id\"").count() != 2 {
418 panic!(
419 "
420crate {name} is not exclusively owned by wasmtime-publish
421
422Please contact wstd maintainers to ensure that `wasmtime-publish` is the
423only listed owner of the crate.
424",
425 name = name,
426 );
427 }
428 }
429}
430
431fn curl(url: &str) -> Option<String> {

Callers 1

verifyFunction · 0.85

Calls 2

curlFunction · 0.85
splitMethod · 0.80

Tested by

no test coverage detected