Skip to content

Commit 0998ac2

Browse files
authored
feat: Multiple organization scan and fixed broken py2neo (#83)
* Scan multipule organization in one command. * Fixed py2neo dependency fail. * Fixed test file.
1 parent 7b12b21 commit 0998ac2

6 files changed

Lines changed: 17 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ options:
154154

155155
Retrieve all workflows and actions associated with the organization.
156156
``` bash
157-
raven download org --token $GITHUB_TOKEN --org-name microsoft --debug
157+
raven download org --token $GITHUB_TOKEN --org-name microsoft --org-name google --debug
158158
```
159159

160160
Scrape all publicly accessible GitHub repositories.

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ monotonic==1.6
88
packaging==23.1
99
pansi==2020.7.3
1010
pluggy==1.3.0
11-
py2neo==2021.2.3
1211
Pygments==2.16.1
1312
pytest==7.4.2
1413
pytz==2023.3.post1
@@ -19,4 +18,6 @@ six==1.16.0
1918
slack-sdk==3.22.0
2019
tabulate==0.9.0
2120
tqdm==4.66.1
22-
urllib3==2.0.5
21+
urllib3==2.0.5
22+
23+
py2neo @ git+https://github.com/elad-pticha/py2neo.git@d684901abeeb1484e5b396d4b6cef491c4bd8271#egg=py2neo

src/cmdline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ def raven() -> None:
151151
org_download_parser.add_argument(
152152
"--org-name",
153153
required=True,
154+
action="append",
155+
type=str,
154156
help="Organization name to download the workflows",
155157
)
156158

src/config/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class Config:
9696
github_token: str = None
9797
min_stars: int = None
9898
max_stars: int = None
99-
org_name: str = None
99+
org_name: list[str] = []
100100

101101
# Indexer Configs
102102
clean_neo4j: bool = None

src/downloader/download.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@ def download_org_workflows_and_actions() -> None:
3434
We are trying to cache the downloads as much as we can to reduce redundant download attempts.
3535
"""
3636
log.debug("[+] Starting organization repository iterator")
37-
generator = get_organization_repository_generator(Config.org_name)
3837

39-
# Clean redis
40-
if Config.clean_redis:
41-
clean_redis_db()
38+
for organization in Config.org_name:
39+
log.debug(f"[+] Scanning {organization}")
40+
generator = get_organization_repository_generator(organization)
4241

43-
for repo in generator:
44-
download_workflows_and_actions(repo)
42+
# Clean redis
43+
if Config.clean_redis:
44+
clean_redis_db()
45+
46+
for repo in generator:
47+
download_workflows_and_actions(repo)
4548

4649

4750
def download_all_workflows_and_actions() -> None:

tests/test_raven.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
def load_integration_tests_config() -> None:
1717
load_downloader_config(
18-
{"debug": False, "token": getenv("GITHUB_TOKEN"), "org_name": "RavenDemo"}
18+
{"debug": False, "token": getenv("GITHUB_TOKEN"), "org_name": ["RavenDemo"]}
1919
)
2020

2121
load_indexer_config(

0 commit comments

Comments
 (0)