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