Add setting to disable posting of commit statuses

Useful for testing.
This commit is contained in:
Stéphane Bidoul 2021-11-28 13:21:06 +01:00
parent 0a67e157e0
commit bddc6bf88e
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
2 changed files with 4 additions and 0 deletions

View file

@ -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",

View file

@ -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: