-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add download all repos and search
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
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,20 @@ | ||
#!/bin/sh | ||
|
||
owner="freight-hub" | ||
gh repo list ${owner} --no-archived --limit 4000 | while read -r repo _; do | ||
gh repo clone "$repo" "$repo" | ||
done | ||
|
||
string1="transport-network.api" | ||
string2="depots" | ||
|
||
# list the files involving the strings | ||
rg -l ${string1} > results1.txt | ||
rg -l ${string2} > results2.txt | ||
|
||
# extract prefix (i.e repo name) and write it to different file | ||
awk -F'/' '{print $1}' results1.txt | sort | uniq > repos1.txt | ||
awk -F'/' '{print $1}' results2.txt | sort | uniq > repos2.txt | ||
|
||
# list common ones | ||
comm -12 repos1.txt repos2.txt |