From 22f72eba3e3ae458950098523b113754fb9374ad Mon Sep 17 00:00:00 2001 From: Scott Chamberlain Date: Mon, 16 Sep 2024 15:17:31 -0700 Subject: [PATCH] force terminal to get colorized in gh actions --- repository.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/repository.py b/repository.py index 1bf1377..7ab66eb 100644 --- a/repository.py +++ b/repository.py @@ -2,6 +2,8 @@ from ghapi.all import GhApi from registry import WildsRegistry from rich import print +from rich.console import Console +console = Console(force_terminal=True) api = GhApi() reg = WildsRegistry() @@ -12,11 +14,11 @@ def check_for_main(repo): repo_gh = api.repos.get("getwilds", repo["name"]) default = repo_gh['default_branch'] - if "mains" != default: - print(f'[bold red]{repo["name"]}[/bold red] needs a main branch as default; instead got {default}') + if "main" != default: + console.print(f'[bold red]{repo["name"]}[/bold red] needs a main branch as default; instead got {default}') # raise Exception(f'[bold red]{repo["name"]}[/bold red] needs a main branch as default; instead got {default}') else: - print(f"[bold green]{repo["name"]}[/bold green] all good") + console.print(f"[bold green]{repo["name"]}[/bold green] all good") # repo = Repository(".") # if "mains" not in list(repo.branches.local): # raise Exception(f'main branch not found for {repo}')