This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Add a script to search and add githubs repos for a specific language #181
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
# This script is exclusively developed for parser development purposes. It serves the specific use case of ingesting GitHub repositories internally for SAAS. | ||
|
||
# Create out folder if not exist | ||
mkdir -p out | ||
|
||
# Search and add github repos by language, change the below language | ||
|
||
# generate `gh.json` which includes repo fullName and branch name, | ||
# Manually customize the language and adjust the count below according to your specific requirements. | ||
# option to add filter: --updated="> 2023-11-21" | ||
gh search repos --language javascript --visibility public --limit 1000 --json fullName,defaultBranch > out/gh.json | ||
|
||
# generate `new.csv`, which will be merged to `repos.csv` | ||
cat out/gh.json | jq -r '.[] | ",\(.fullName),\(.defaultBranch),,,,,,,"' > out/new.csv | ||
|
||
# generate `repos.json`, which will be used to update `ownership.json` | ||
cat out/gh.json | jq -r '.[] | " { | ||
\"origin\": \"github.com\", | ||
\"path\": \"" + .fullName + "\", | ||
\"branch\": \"" + .defaultBranch + "\" | ||
},"' | sed '$s/,$//' > out/repos-content.json | ||
|
||
# Merge `new.csv` to `repos.csv` | ||
cd parser/ | ||
./gradlew build && java -cp build/libs/parser-1.0-SNAPSHOT.jar io.moderne.jenkins.ingest.Merger ../repos.csv ../out/new.csv | ||
kunli2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Quick analysis of largest organizations | ||
cut --delimiter='/' --fields=1 repos.csv | sort | uniq -c | sort -h | tail -n 20 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well make
javascript
a script parameter. In addition we could also document that it could be interesting to set--sort stars
(and / or--updated "> $(date -v-1m "+%Y-%m-%d")"
to get repos updated in the last month), as users might be more inclined to run recipes against popular repos.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I thought about this to put both language and count as script parameters, and then I think it will be used by us internally and we might want to do other customization, so I leave it as hard coded since anyway we need to type the language somewhere. We can update this for any needs for sure.