From bddc6bf88e85517fd2b82b7e7544869d42856174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 28 Nov 2021 13:21:06 +0100 Subject: [PATCH] Add setting to disable posting of commit statuses Useful for testing. --- src/runboat/github.py | 2 ++ src/runboat/settings.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/runboat/github.py b/src/runboat/github.py index e1e78ef..08bf5be 100644 --- a/src/runboat/github.py +++ b/src/runboat/github.py @@ -64,6 +64,8 @@ class GitHubStatusState(str, Enum): async def notify_status( repo: str, sha: str, state: GitHubStatusState, target_url: str | None ) -> None: + if settings.disable_commit_statuses: + return # https://docs.github.com/en/rest/reference/repos#create-a-commit-status await _github_request( "POST", diff --git a/src/runboat/settings.py b/src/runboat/settings.py index 953b8ce..6cf3a72 100644 --- a/src/runboat/settings.py +++ b/src/runboat/settings.py @@ -58,6 +58,8 @@ class Settings(BaseSettings): base_url: str = "http://localhost:8000" # HTML fragment for second footer. additional_footer_html: str = "" + # Disable posting of statuses to GitHub commits + disable_commit_statuses: bool = False def get_build_settings(self, repo: str, target_branch: str) -> list[BuildSettings]: for repo_settings in self.repos: