Skip to content

Commit cfe2ced

Browse files
committed
In very atypical cases a workflow can have an empty path attribute. Handle said case.
1 parent c6bd586 commit cfe2ced

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/gitxray/xrays/workflows_xray.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ def run(gx_context, gx_output, gh_api):
5454
all_c_runs = sum(run_contributors.values())
5555
gx_output.r_log(f"Workflow [{workflow.get('name')}] was run by [{all_non_c_runners}] NON-contributors [{all_non_c_runs}] times and by [{all_c_runners}] contributors [{all_c_runs}] times. [{repository.get('html_url')}/actions/workflows/{workflow_file}]", rtype="workflows")
5656

57-
contents = gh_api.fetch_repository_file_contents(repository, workflow.get('path'))
57+
# Workflows may not contain a path - I believe those cases are for legacy workflows, seldom run into them
58+
if len(workflow.get('path')) > 0: contents = gh_api.fetch_repository_file_contents(repository, workflow.get('path'))
59+
else: contents = {}
5860
if contents.get('content') != None:
5961

6062
# We have the contents of a workflow, let's analyze it.

0 commit comments

Comments
 (0)