From 0eb2ea4affd98e871aefcce675c8b838cd69b84f Mon Sep 17 00:00:00 2001 From: XargonWan Date: Wed, 8 Jan 2025 13:44:02 +0900 Subject: [PATCH] RUNTIME_CHECKER: added proto script [skip ci] --- runtime_checker.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 runtime_checker.sh diff --git a/runtime_checker.sh b/runtime_checker.sh new file mode 100755 index 00000000..778ead51 --- /dev/null +++ b/runtime_checker.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# TODO: finish me + +# Set the organization name +ORG="RetroDECK" + +# Get all non-archived repositories of the organization +repos=$(curl -s "https://api.github.com/orgs/$ORG/repos?per_page=100" | jq -r '.[] | select(has("archived") and .archived == false) | .name') + +# Iterate over each repository +for repo in $repos; do + echo "Checking repository: $repo" + + # Get the files in the root of the repository + files=$(curl -s "https://api.github.com/repos/$ORG/$repo/contents" | jq -r '.[] | select(.type == "file" and (.path | index("/") == null)) | .name') + + # Check for .yml, .yaml, and .json files + for ext in yml yaml json; do + file=$(echo "$files" | grep -E "\.$ext$") + if [ -n "$file" ]; then + # Download the file content + content=$(curl -s "https://raw.githubusercontent.com/$ORG/$repo/main/$file") + + # Check if it contains "runtime" + if echo "$content" | grep -q "runtime"; then + echo "Found in $file" + app_id=$(echo "$content" | grep "app-id" | awk '{print $2}') + runtime=$(echo "$content" | grep "runtime" | awk '{print $2}') + runtime-version=$(echo "$content" | grep "runtime-version" | awk '{print $2}') + sdk=$(echo "$content" | grep "sdk" | awk '{print $2}') + + echo "Repository: $repo" + echo "File: $file" + echo "app-id: $app_id" + echo "runtime: $runtime" + echo "runtime-version: $runtime_version" + echo "sdk: $sdk" + echo "-------------------------" + break + fi + fi + done +done \ No newline at end of file