fix: contributers
This commit is contained in:
parent
119f3ad925
commit
fe40d1be7f
@ -1,13 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# List all repositories for the user
|
# Fetch all private repositories where you are an owner or collaborator
|
||||||
REPOS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
REPOS_DATA=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
||||||
"https://api.github.com/users/$GITHUB_USER/repos?per_page=100&visibility=private" | jq -r '.[].name')
|
"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
|
for REPO in $REPOS; do
|
||||||
echo "🔍 Scanning $REPO..."
|
# Extract the repo owner (useful if it belongs to an org)
|
||||||
curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
OWNER=$(echo "$REPOS_DATA" | jq -r --arg REPO "$REPO" '.[] | select(.name==$REPO) | .owner.login')
|
||||||
"https://api.github.com/repos/$GITHUB_USER/$REPO/contributors" | jq -r '.[].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
|
done
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user