Move scanner outputs out of repo root
This commit is contained in:
parent
14d1b566d6
commit
f59fcc58b1
2
.gitignore
vendored
2
.gitignore
vendored
@ -31,8 +31,10 @@ Thumbs.db
|
|||||||
# Local environment and secret-bearing files
|
# Local environment and secret-bearing files
|
||||||
.env
|
.env
|
||||||
*.env
|
*.env
|
||||||
|
accounts.json
|
||||||
|
|
||||||
# Generated outputs and local data caches
|
# Generated outputs and local data caches
|
||||||
supabase monitor/output/
|
supabase monitor/output/
|
||||||
youtube/captions/
|
youtube/captions/
|
||||||
github_repo_scanners/contributor_repos/
|
github_repo_scanners/contributor_repos/
|
||||||
|
github_repo_scanners/user_repos/
|
||||||
|
|||||||
@ -85,6 +85,7 @@ Key files:
|
|||||||
- `create_user_repo_lists.sh`
|
- `create_user_repo_lists.sh`
|
||||||
- `create_contributor_repo_lists.sh`
|
- `create_contributor_repo_lists.sh`
|
||||||
- `run_contributor_json_creation.sh`
|
- `run_contributor_json_creation.sh`
|
||||||
|
- `user_repos/`
|
||||||
- `contributor_repos/*.json`
|
- `contributor_repos/*.json`
|
||||||
|
|
||||||
### `Slack Message/`
|
### `Slack Message/`
|
||||||
|
|||||||
@ -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.
|
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:**
|
**Command:**
|
||||||
```bash
|
```bash
|
||||||
./github_repo_scanners/create_user_repo_lists.sh <path_to_accounts.json>
|
./github_repo_scanners/create_user_repo_lists.sh <path_to_accounts.json>
|
||||||
@ -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.
|
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:**
|
**Command:**
|
||||||
```bash
|
```bash
|
||||||
./github_repo_scanners/create_contributor_repo_lists.sh <path_to_accounts.json>
|
./github_repo_scanners/create_contributor_repo_lists.sh <path_to_accounts.json>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
ACCOUNTS_FILE="accounts.json"
|
ACCOUNTS_FILE="accounts.json"
|
||||||
|
OUTPUT_DIR="github_repo_scanners/user_repos"
|
||||||
|
|
||||||
# Check if accounts.json exists
|
# Check if accounts.json exists
|
||||||
if [ ! -f "$ACCOUNTS_FILE" ]; then
|
if [ ! -f "$ACCOUNTS_FILE" ]; then
|
||||||
@ -8,6 +9,8 @@ if [ ! -f "$ACCOUNTS_FILE" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$OUTPUT_DIR"
|
||||||
|
|
||||||
# Loop through each account in accounts.json
|
# Loop through each account in accounts.json
|
||||||
jq -c '.[]' "$ACCOUNTS_FILE" | while read -r account; do
|
jq -c '.[]' "$ACCOUNTS_FILE" | while read -r account; do
|
||||||
USER=$(echo "$account" | jq -r '.user')
|
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)
|
# Get all repos the user has access to (owner, collaborator, org member)
|
||||||
# and format the output as a JSON array.
|
# 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" | \
|
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
|
done
|
||||||
|
|
||||||
echo "All user repository lists have been created."
|
echo "All user repository lists have been created in '${OUTPUT_DIR}'."
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user