From e9de06fe67c5db381933cc56bcbdbe3536687b05 Mon Sep 17 00:00:00 2001 From: Ludovic Ortega Date: Mon, 18 Nov 2024 23:11:50 +0000 Subject: [PATCH] fix: ruff lint Signed-off-by: Ludovic Ortega --- __main__.py | 22 +++++++++++++++----- src/git_automation/GitRepositoryComponent.py | 8 +++---- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/__main__.py b/__main__.py index 08d3c0a..51e588a 100644 --- a/__main__.py +++ b/__main__.py @@ -16,11 +16,23 @@ workflow_changelog = False if "workflow" in repository_config: workflow = True - workflow_lint = "lint" not in repository_config["workflow"] or repository_config["workflow"]["lint"] - workflow_test = "test" not in repository_config["workflow"] or repository_config["workflow"]["test"] - workflow_package = "package" not in repository_config["workflow"] or repository_config["workflow"]["package"] - workflow_changelog = "changelog" not in repository_config["workflow"] or repository_config["workflow"]["changelog"] - + workflow_lint = ( + "lint" not in repository_config["workflow"] + or repository_config["workflow"]["lint"] + ) + workflow_test = ( + "test" not in repository_config["workflow"] + or repository_config["workflow"]["test"] + ) + workflow_package = ( + "package" not in repository_config["workflow"] + or repository_config["workflow"]["package"] + ) + workflow_changelog = ( + "changelog" not in repository_config["workflow"] + or repository_config["workflow"]["changelog"] + ) + devcontainer = repository_config.get("devcontainer", False) helm = repository_config.get("helm", False) package = "package_name" in repository_config and repository_config["package_name"] diff --git a/src/git_automation/GitRepositoryComponent.py b/src/git_automation/GitRepositoryComponent.py index 6fcbccb..83ae510 100644 --- a/src/git_automation/GitRepositoryComponent.py +++ b/src/git_automation/GitRepositoryComponent.py @@ -347,10 +347,10 @@ def sync_readme( # check if a readme already exist r = requests.get( f"https://api.github.com/repos/{self.owner}/{self.name}/contents/README.md", - headers = { + headers={ "Accept": "application/vnd.github.raw+json", - "Authorization": f"Bearer {os.environ["GITHUB_TOKEN"]}" - } + "Authorization": f"{os.environ["GITHUB_TOKEN"]}" + }, ) if r.status_code == 200: template = env.from_string(self.regenerate_readme_template(r.text)) @@ -387,8 +387,6 @@ def sync_workflow( ): template = env.get_template(os.path.join("workflow", "lint-pr.yml.j2")) - - self._repository_file( "workflow", ".github/workflows/lint-pr.yml",