ci: use crates api to get owner list (#31348)

use crete api to get owner lists
This commit is contained in:
Yihau Chen 2023-04-26 08:36:50 +08:00 committed by GitHub
parent 466c3c36d8
commit e79e13899d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -50,9 +50,11 @@ for file in "${files[@]}"; do
fi fi
done done
result="$(cargo owner --list -q "$crate_name" --token "$CRATE_TOKEN" 2>&1)" response=$(curl -s https://crates.io/api/v1/crates/"$crate_name"/owners)
if [[ $result =~ ^error ]]; then errors=$(echo "$response" | jq .errors)
if [[ $result == *"Not Found"* ]]; then if [[ $errors != "null" ]]; then
details=$(echo "$response" | jq .errors | jq -r ".[0].detail")
if [[ $details = *"Not Found"* ]]; then
((error_count++)) ((error_count++))
echo "❌ new crate $crate_name not found on crates.io. you can either echo "❌ new crate $crate_name not found on crates.io. you can either
@ -83,10 +85,10 @@ or
" "
else else
((error_count++)) ((error_count++))
echo "$result" echo "$response"
fi fi
else else
readarray -t owners <<<"$result" readarray -t owners <<<"$(echo "$response" | jq .users | jq -r ".[] | .login")"
verified_owner_count=0 verified_owner_count=0
unverified_owner_count=0 unverified_owner_count=0
@ -113,6 +115,7 @@ or
fi fi
fi fi
echo "" echo ""
done done
if [ "$error_count" -eq 0 ]; then if [ "$error_count" -eq 0 ]; then