Skip to content

Instantly share code, notes, and snippets.

@sounddrill31
Last active April 27, 2024 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sounddrill31/f0165d85002f5318ee84c742d1d56bbc to your computer and use it in GitHub Desktop.
Save sounddrill31/f0165d85002f5318ee84c742d1d56bbc to your computer and use it in GitHub Desktop.
#!/bin/bash
# Make and Prepare Workspace
mkdir -p forks_workspace
cd forks_workspace
rm -rf *
# Replace this with the URL of the repository you want to check
REPO_URL="sounddrill31/crave_aosp_builder"
# Handles escaping
ESCAPED_CRAVE_USERNAME="\${CRAVE_USERNAME}"
ESCAPED_CRAVE_TOKEN="\${CRAVE_TOKEN}"
# Set your GitHub access token here
GITHUB_TOKEN=""
# Get the list of forks
FORKS=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/${REPO_URL}/forks" | jq -r '.[].html_url')
for fork in $FORKS; do
# Fork the repository
git clone --quiet $fork
repo_name=$(basename $fork)
cd $repo_name
# Check for */crave.conf.sample
if [ -f "crave.conf.sample" ]; then
# Check if ${CRAVE_USERNAME} (without interpreting variable) exists inside */crave.conf.sample
if grep -q "${ESCAPED_CRAVE_USERNAME}" "crave.conf.sample"; then
if grep -q "${ESCAPED_CRAVE_TOKEN}" "crave.conf.sample"; then
echo "Fork $fork is valid"
else
echo "Fork $fork is invalid (CRAVE_TOKEN was changed)"
fi
else
echo "Fork $fork is invalid (CRAVE_USERNAME was changed)"
fi
else
echo "Fork $fork is invalid (crave.conf.sample missing)"
fi
# Remove the forked repository
cd ..
rm -rf $repo_name
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment