fix: contributers
This commit is contained in:
parent
119f3ad925
commit
fe40d1be7f
@ -1,13 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# List all repositories for the user
|
||||
REPOS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
||||
"https://api.github.com/users/$GITHUB_USER/repos?per_page=100&visibility=private" | jq -r '.[].name')
|
||||
# Fetch all private repositories where you are an owner or collaborator
|
||||
REPOS_DATA=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
||||
"https://api.github.com/user/repos?per_page=100&affiliation=owner,collaborator&visibility=private")
|
||||
|
||||
echo "Fetching contributors from all repositories..."
|
||||
# Extract repository names
|
||||
REPOS=$(echo "$REPOS_DATA" | jq -r '.[].name')
|
||||
|
||||
if [[ -z "$REPOS" ]]; then
|
||||
echo "❌ No private repositories found or token missing 'repo' scope."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Fetching contributors and owners from all private repositories..."
|
||||
for REPO in $REPOS; do
|
||||
echo "🔍 Scanning $REPO..."
|
||||
curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
||||
"https://api.github.com/repos/$GITHUB_USER/$REPO/contributors" | jq -r '.[].login'
|
||||
# Extract the repo owner (useful if it belongs to an org)
|
||||
OWNER=$(echo "$REPOS_DATA" | jq -r --arg REPO "$REPO" '.[] | select(.name==$REPO) | .owner.login')
|
||||
|
||||
echo "🔍 Scanning $REPO (Owner: $OWNER)..."
|
||||
|
||||
# List contributors
|
||||
CONTRIBUTORS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
||||
"https://api.github.com/repos/$OWNER/$REPO/contributors" | jq -r '.[].login')
|
||||
|
||||
if [[ -z "$CONTRIBUTORS" ]]; then
|
||||
echo "🚫 No contributors found. (Owner: $OWNER)"
|
||||
else
|
||||
echo "📌 Owner: $OWNER"
|
||||
echo "$CONTRIBUTORS"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user