Last active
April 27, 2024 08:15
-
-
Save sounddrill31/f0165d85002f5318ee84c742d1d56bbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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