From aa68cfc2f5d1b031ef67b055ea2af07ba9021c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Sat, 2 Nov 2024 16:43:39 +0100 Subject: [PATCH] Workflow: Fix update date --- github_app_geo_project/module/workflow/__init__.py | 5 ++--- tests/test_module_workflow.py | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/github_app_geo_project/module/workflow/__init__.py b/github_app_geo_project/module/workflow/__init__.py index 1d036486f1..3a1b9e4eee 100644 --- a/github_app_geo_project/module/workflow/__init__.py +++ b/github_app_geo_project/module/workflow/__init__.py @@ -74,10 +74,9 @@ async def process( else: _LOGGER.debug("No SECURITY.md file in the repository, apply on default branch") - stabilization_branches = [repo.default_branch] for key in list(repo_data.keys()): - if key not in stabilization_branches or key == "updated": + if key not in stabilization_branches and key != "updated": del repo_data[key] head_branch = context.event_data.get("workflow_run", {}).get("head_branch") @@ -96,7 +95,7 @@ async def process( del branch_data[workflow_name] if not branch_data: del repo_data[head_branch] - if not repo_data: + if repo_data.keys() == {"updated"}: del context.transversal_status[ context.github_project.owner + "/" + context.github_project.repository ] diff --git a/tests/test_module_workflow.py b/tests/test_module_workflow.py index e953ed095d..7a0608ae98 100644 --- a/tests/test_module_workflow.py +++ b/tests/test_module_workflow.py @@ -71,7 +71,8 @@ async def test_process_failure() -> None: # Call the process method output = await workflow.process(context) - print(output) + assert "updated" in output.transversal_status["owner/repository"] + del output.transversal_status["owner/repository"]["updated"] # Assert the expected output assert output.transversal_status == { "owner/repository": {