Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit d5c087f

Browse files
committed
fix yaml location if not in project dir codecov/support#402
1 parent 1deec43 commit d5c087f

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

codecov/__init__.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -575,23 +575,26 @@ def main(*argv, **kwargs):
575575
re.M
576576
)
577577
if yaml_location:
578-
query['yaml'] = yaml_location.group()
579-
yaml = fopen(opj(os.getcwd(), query['yaml']))
580-
_token = re.search(
581-
r'token: (\'|\")?([0-9a-f]{8}(-?[0-9a-f]{4}){3}-?[0-9a-f]{12})',
582-
yaml,
583-
re.M
584-
)
585-
if _token:
586-
query['token'] = _token.groups()[1]
587-
588-
_slug = re.search(
589-
r'slug: (\'|\")?([\w\-\.\+]+\/[\w\-\.\+]+)',
590-
yaml,
591-
re.M
592-
)
593-
if _slug:
594-
query['slug'] = _slug.groups()[1]
578+
yaml_location = yaml_location.group()
579+
yaml_path = opj(root, yaml_location)
580+
if os.path.exists(yaml_path):
581+
query['yaml'] = yaml_location
582+
yaml = fopen(yaml_path)
583+
_token = re.search(
584+
r'token: (\'|\")?([0-9a-f]{8}(-?[0-9a-f]{4}){3}-?[0-9a-f]{12})',
585+
yaml,
586+
re.M
587+
)
588+
if _token:
589+
query['token'] = _token.groups()[1]
590+
591+
_slug = re.search(
592+
r'slug: (\'|\")?([\w\-\.\+]+\/[\w\-\.\+]+)',
593+
yaml,
594+
re.M
595+
)
596+
if _slug:
597+
query['slug'] = _slug.groups()[1]
595598

596599
assert query.get('job') or query.get('token'), "Missing repository upload token"
597600

0 commit comments

Comments
 (0)