Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.venv
dist
__pycache__
14 changes: 10 additions & 4 deletions gha_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ def get_repo_workflow_names(self, repo_name: str) -> Dict[str, str]:
workflow_paths = self._get_github_workflow_filenames(repo_name)
res = dict()
for path in workflow_paths:
content = self._get_workflow_file_content(repo_name, path)
yaml_content = yaml.load(content, Loader=yaml.CLoader)
res[path] = yaml_content.get('name', path)
try:
content = self._get_workflow_file_content(repo_name, path)
yaml_content = yaml.load(content, Loader=yaml.CLoader)
res[path] = yaml_content.get('name', path)
except FileNotFoundError as ex:
logging.warning(ex)
return res

def update_actions(
Expand Down Expand Up @@ -192,7 +195,10 @@ def _get_workflow_file_content(self, repo_name: str, workflow_path: str) -> Unio
f'f{workflow_path} not found in workflows for repository {repo_name}, '
f'possible values: {workflow_paths}', err=True)
repo = self.client.get_repo(repo_name)
workflow_content = repo.get_contents(workflow_path)
try:
workflow_content = repo.get_contents(workflow_path)
except UnknownObjectException:
raise FileNotFoundError(f'Workflow not found in repository: {repo_name}, path: {workflow_path}')
return workflow_content.decoded_content


Expand Down