From f59fcc58b17d68eb784a474f81a2b31f60854926 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 May 2026 01:18:10 +0000 Subject: [PATCH] Move scanner outputs out of repo root --- .gitignore | 2 ++ docs/repo-map.md | 1 + github_access_scripts/README.md | 4 ++++ github_repo_scanners/create_user_repo_lists.sh | 10 ++++++---- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 458bcfb..b8df6f2 100644 --- a/.gitignore +++ b/.gitignore @@ -31,8 +31,10 @@ Thumbs.db # Local environment and secret-bearing files .env *.env +accounts.json # Generated outputs and local data caches supabase monitor/output/ youtube/captions/ github_repo_scanners/contributor_repos/ +github_repo_scanners/user_repos/ diff --git a/docs/repo-map.md b/docs/repo-map.md index c7cea10..d0a68a9 100644 --- a/docs/repo-map.md +++ b/docs/repo-map.md @@ -85,6 +85,7 @@ Key files: - `create_user_repo_lists.sh` - `create_contributor_repo_lists.sh` - `run_contributor_json_creation.sh` +- `user_repos/` - `contributor_repos/*.json` ### `Slack Message/` diff --git a/github_access_scripts/README.md b/github_access_scripts/README.md index e8495ee..0bb7950 100644 --- a/github_access_scripts/README.md +++ b/github_access_scripts/README.md @@ -57,6 +57,8 @@ This directory (`github_repo_scanners`) contains scripts for more advanced repos This script scans all accounts in `accounts.json` and creates a JSON file for each user containing a list of repositories they have access to. +Output files are written under `github_repo_scanners/user_repos/`. + **Command:** ```bash ./github_repo_scanners/create_user_repo_lists.sh @@ -71,6 +73,8 @@ This script scans all accounts in `accounts.json` and creates a JSON file for ea This script scans all accounts in `accounts.json`, finds all contributors to their repositories, and creates a JSON file for each contributor listing the repositories they have contributed to. +The wrapper `run_contributor_json_creation.sh` writes those files under `github_repo_scanners/contributor_repos/`. + **Command:** ```bash ./github_repo_scanners/create_contributor_repo_lists.sh diff --git a/github_repo_scanners/create_user_repo_lists.sh b/github_repo_scanners/create_user_repo_lists.sh index 7bc0f8f..da77c12 100755 --- a/github_repo_scanners/create_user_repo_lists.sh +++ b/github_repo_scanners/create_user_repo_lists.sh @@ -1,6 +1,7 @@ #!/bin/bash ACCOUNTS_FILE="accounts.json" +OUTPUT_DIR="github_repo_scanners/user_repos" # Check if accounts.json exists if [ ! -f "$ACCOUNTS_FILE" ]; then @@ -8,6 +9,8 @@ if [ ! -f "$ACCOUNTS_FILE" ]; then exit 1 fi +mkdir -p "$OUTPUT_DIR" + # Loop through each account in accounts.json jq -c '.[]' "$ACCOUNTS_FILE" | while read -r account; do USER=$(echo "$account" | jq -r '.user') @@ -18,10 +21,9 @@ jq -c '.[]' "$ACCOUNTS_FILE" | while read -r account; do # Get all repos the user has access to (owner, collaborator, org member) # and format the output as a JSON array. curl -s -H "Authorization: token $TOKEN" "https://api.github.com/user/repos?type=all&per_page=100" | \ -jq -r '[.[] | .full_name]' > "${USER}.json" +jq -r '[.[] | .full_name]' > "${OUTPUT_DIR}/${USER}.json" - echo "Successfully created ${USER}.json" + echo "Successfully created ${OUTPUT_DIR}/${USER}.json" done -echo "All user repository lists have been created." - +echo "All user repository lists have been created in '${OUTPUT_DIR}'."