Skip to content

Commit

Permalink
fix(events): split up github
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Focko <[email protected]>
  • Loading branch information
mfocko committed Oct 21, 2024
1 parent fc1afde commit feb7e0e
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 10 deletions.
8 changes: 6 additions & 2 deletions packit_service/worker/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@
Event,
AbstractForgeIndependentEvent,
)
from packit_service.worker.events.github.abstract import GithubEvent as AbstractGithubEvent
from packit_service.worker.events.github.abstract import (
GithubEvent as AbstractGithubEvent,
)
from packit_service.worker.events.github.check import (
Commit as CheckRerunCommitEvent,
PullRequest as CheckRerunPullRequestEvent,
Release as CheckRerunReleaseEvent,
Rerun as CheckRerunEvent,
)
from packit_service.worker.events.github.installation import Installation as InstallationEvent
from packit_service.worker.events.github.installation import (
Installation as InstallationEvent,
)
from packit_service.worker.events.github.issue import Comment as IssueCommentEvent
from packit_service.worker.events.github.pr import (
Comment as PullRequestCommentGithubEvent,
Expand Down
2 changes: 2 additions & 0 deletions packit_service/worker/events/github/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
5 changes: 4 additions & 1 deletion packit_service/worker/events/github/abstract.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

from typing import Optional

from packit_service.worker.events.event import AbstractForgeIndependentEvent
Expand All @@ -10,4 +13,4 @@ def __init__(self, project_url: str, pr_id: Optional[int] = None, **kwargs):
self.git_ref: Optional[str] = None # git ref that can be 'git checkout'-ed
self.identifier: Optional[str] = (
None # will be shown to users -- e.g. in logs or in the copr-project name
)
)
3 changes: 3 additions & 0 deletions packit_service/worker/events/github/check.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

from typing import Optional

from packit_service.models import (
Expand Down
3 changes: 3 additions & 0 deletions packit_service/worker/events/github/installation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

from typing import Optional, Union

from packit_service.models import AllowlistStatus
Expand Down
7 changes: 5 additions & 2 deletions packit_service/worker/events/github/issue.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

from typing import Optional

from ogr.abstract import Comment
from ogr.abstract import Comment as OgrComment

from packit_service.worker.events.comment import AbstractIssueCommentEvent
from packit_service.worker.events.enums import IssueCommentAction
Expand All @@ -23,7 +26,7 @@ def __init__(
base_ref: Optional[
str
] = "master", # default is master when working with issues
comment_object: Optional[Comment] = None,
comment_object: Optional[OgrComment] = None,
dist_git_project_url=None,
) -> None:
super().__init__(
Expand Down
12 changes: 9 additions & 3 deletions packit_service/worker/events/github/pr.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

from typing import Optional

from ogr.abstract import Comment, GitProject
from ogr.abstract import Comment as OgrComment, GitProject

from packit_service.service.db_project_events import AddPullRequestEventToDb
from packit_service.worker.events.comment import AbstractPRCommentEvent
from packit_service.worker.events.enums import PullRequestAction, PullRequestCommentAction
from packit_service.worker.events.enums import (
PullRequestAction,
PullRequestCommentAction,
)
from packit_service.worker.events.github.abstract import GithubEvent


Expand Down Expand Up @@ -58,7 +64,7 @@ def __init__(
comment: str,
comment_id: int,
commit_sha: Optional[str] = None,
comment_object: Optional[Comment] = None,
comment_object: Optional[OgrComment] = None,
) -> None:
super().__init__(
pr_id=pr_id,
Expand Down
3 changes: 3 additions & 0 deletions packit_service/worker/events/github/push.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

from packit_service.service.db_project_events import AddBranchPushEventToDb
from packit_service.worker.events.github.abstract import GithubEvent

Expand Down
3 changes: 3 additions & 0 deletions packit_service/worker/events/github/release.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT

from typing import Optional

from packit_service.service.db_project_events import AddReleaseEventToDb
Expand Down
4 changes: 3 additions & 1 deletion packit_service/worker/handlers/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
)
from packit_service.worker.events.event import EventData
from packit_service.worker.events.copr import AbstractCoprBuildEvent
from packit_service.worker.events.github.pr import Comment as PullRequestCommentGithubEvent
from packit_service.worker.events.github.pr import (
Comment as PullRequestCommentGithubEvent,
)
from packit_service.worker.events.gitlab import MergeRequestCommentGitlabEvent
from packit_service.worker.events.pagure import PullRequestCommentPagureEvent
from packit_service.worker.handlers.abstract import CeleryTask
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
AbstractCoprBuildEvent,
)
from packit_service.worker.events.event import EventData
from packit_service.worker.events.github.pr import Comment as PullRequestCommentGithubEvent
from packit_service.worker.events.github.pr import (
Comment as PullRequestCommentGithubEvent,
)
from packit_service.worker.events.github.push import Push as PushGitHubEvent
from packit_service.worker.events.gitlab import MergeRequestGitlabEvent, PushGitlabEvent
from packit_service.worker.events.pagure import PushPagureEvent
Expand Down

0 comments on commit feb7e0e

Please sign in to comment.