Merge pull request #141 from Mic92/faster-github

Gitea: don't drop pull request events
This commit is contained in:
Jörg Thalheim 2024-05-03 20:41:55 +02:00 committed by GitHub
commit 22885edd30
Failed to generate hash of commit
2 changed files with 9 additions and 12 deletions

View file

@ -181,6 +181,9 @@ class GiteaBackend(GitBackend):
def create_change_hook(self) -> dict[str, Any]:
return {
"secret": self.webhook_secret,
# The "mergable" field is a bit buggy,
# we already do the merge locally anyway.
"onlyMergeablePullRequest": False,
}
def create_avatar_method(self) -> AvatarBase | None:

View file

@ -17,14 +17,17 @@ from buildbot.www.auth import AuthBase
from buildbot.www.avatar import AvatarBase, AvatarGitHub
from buildbot.www.oauth2 import GitHubAuth
from twisted.internet import defer, threads
from twisted.internet.defer import ensureDeferred
from twisted.python import log
from twisted.python.failure import Failure
if TYPE_CHECKING:
from buildbot.process.log import StreamLog
from .common import http_request, paginated_github_request, slugify_project_name
from .common import (
http_request,
paginated_github_request,
slugify_project_name,
)
from .projects import GitBackend, GitProject
from .secrets import read_secret_file
@ -78,15 +81,6 @@ class GithubConfig:
return read_secret_file(self.token_secret_name)
class AsyncGitHubStatusPush(GitHubStatusPush):
@defer.inlineCallbacks
def sendMessage( # noqa: N802
self, reports: list[dict[str, Any]]
) -> Generator[Any, object, Any]:
# Don't block the CI on the GitHub status updates
yield ensureDeferred(super().sendMessage(reports))
@dataclass
class GithubBackend(GitBackend):
config: GithubConfig
@ -109,7 +103,7 @@ class GithubBackend(GitBackend):
)
def create_reporter(self) -> ReporterBase:
return AsyncGitHubStatusPush(
return GitHubStatusPush(
token=self.config.token(),
# Since we dynamically create build steps,
# we use `virtual_builder_name` in the webinterface