Skip to content

Commit

Permalink
Merge pull request #590 from camptocamp/default-name
Browse files Browse the repository at this point in the history
Workflow: Better default workflow name
  • Loading branch information
sbrunner authored Nov 2, 2024
2 parents bc3b3fc + e4104a8 commit 8d540d8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions github_app_geo_project/module/workflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ async def process(
return module.ProcessOutput()

branch_data = repo_data.setdefault(head_branch, {})
workflow_name = context.event_data.get("workflow", {}).get("name", "Un named")
if context.event_data.get("workflow_run", {}).get("conclusion") == "success":
if context.event_data.get("workflow", {}).get("name", "-") in branch_data:
del branch_data[context.event_data.get("workflow", {}).get("name", "-")]
if workflow_name in branch_data:
del branch_data[workflow_name]
if not branch_data:
del repo_data[head_branch]
if not repo_data:
Expand All @@ -102,7 +103,7 @@ async def process(
]
_LOGGER.info(
"Workflow '%s' is successful, removing it from the status",
context.event_data.get("workflow", {}).get("name", "-"),
workflow_name,
)
return module.ProcessOutput(transversal_status=context.transversal_status)

Expand All @@ -111,10 +112,10 @@ async def process(
"date": context.event_data.get("workflow_run", {}).get("created_at"),
"jobs": [],
}
branch_data[context.event_data.get("workflow", {}).get("name", "-")] = workflow_data
branch_data[workflow_name] = workflow_data
_LOGGER.info(
"Workflow '%s' is not successful, adding it to the status",
context.event_data.get("workflow", {}).get("name", "-"),
workflow_name,
)

workflow_run = repo.get_workflow_run(context.event_data.get("workflow_run", {}).get("id"))
Expand Down

0 comments on commit 8d540d8

Please sign in to comment.