Skip to content

Commit ab8f20f

Browse files
committed
validation added
1 parent caeaba6 commit ab8f20f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def parse_args():
6363
help=(
6464
'Path to the file containing the list of repositories. '
6565
'Repositories should be separated by a line break. '
66-
'Names should be in the format <organization or owner>/<name> '
66+
'Names must be in the format <organization or owner>/<name> '
6767
),
6868
)
6969
parser.add_argument(

src/git_logger.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
from time import sleep
23
import logging
34
import traceback
@@ -35,6 +36,11 @@ def get_tokens_from_file(tokens_path: str) -> list[str]:
3536
def get_repos_from_file(repos_path: str) -> list[str]:
3637
with open(repos_path, 'r') as file:
3738
list_repos = [x for x in file.read().split('\n') if x]
39+
for repo in list_repos:
40+
pattern = r'[0-9A-Za-z-_\.]+/[0-9A-Za-z-_\.]+'
41+
if not re.fullmatch(pattern, repo):
42+
print('Names must be in the format <organization or owner>/<name>')
43+
exit(1)
3844

3945
return list_repos
4046

0 commit comments

Comments
 (0)