-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
298 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
from github_contexts.github.context import GitHubContext | ||
from github_contexts.github import enums, payloads | ||
from github_contexts.github import enum, payload | ||
|
||
|
||
def create(context: dict) -> GitHubContext: | ||
"""Create a GitHub context object from the given dictionary.""" | ||
return GitHubContext(context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from github_contexts.github.payload import object | ||
from github_contexts.github.payload.base import Payload | ||
from github_contexts.github.payload.issue_comment import IssueCommentPayload | ||
from github_contexts.github.payload.issues import IssuesPayload | ||
from github_contexts.github.payload.pull_request import PullRequestPayload | ||
from github_contexts.github.payload.push import PushPayload | ||
from github_contexts.github.payload.schedule import SchedulePayload | ||
from github_contexts.github.payload.workflow_dispatch import WorkflowDispatchPayload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"""GitHub Webhook Issues Payload.""" | ||
|
||
|
||
from github_contexts.github.payload.base import Payload | ||
from github_contexts.github.enum import ActionType | ||
from github_contexts.github.payload.object.issue import Issue | ||
from github_contexts.github.payload.object.user import User | ||
from github_contexts.github.payload.object.milestone import Milestone | ||
from github_contexts.github.payload.object.label import Label | ||
from github_contexts.github.payload.object.changes import ( | ||
IssueOpenedChanges, IssueEditedChanges, IssueTransferredChanges | ||
) | ||
|
||
|
||
class IssuesPayload(Payload): | ||
|
||
def __init__(self, payload: dict): | ||
super().__init__(payload=payload) | ||
return | ||
|
||
@property | ||
def action(self) -> ActionType: | ||
return ActionType(self._payload["action"]) | ||
|
||
@property | ||
def issue(self) -> Issue: | ||
"""The issue data. | ||
References | ||
---------- | ||
- [GitHub API Docs](https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#get-an-issue) | ||
""" | ||
return Issue(self._payload["issue"]) | ||
|
||
@property | ||
def assignee(self) -> User | None: | ||
"""The user that was assigned or unassigned from the issue. | ||
This is only available for the 'assigned' and 'unassigned' events. | ||
""" | ||
return User(self._payload.get("assignee")) | ||
|
||
@property | ||
def changes(self) -> IssueOpenedChanges | IssueEditedChanges | IssueTransferredChanges | None: | ||
"""The changes to the issue if the action was 'edited'.""" | ||
if self.action == ActionType.EDITED: | ||
return IssueEditedChanges(self._payload["changes"]) | ||
if self.action == ActionType.OPENED: | ||
return IssueOpenedChanges(self._payload["changes"]) | ||
if self.action == ActionType.TRANSFERRED: | ||
return IssueTransferredChanges(self._payload["changes"]) | ||
return | ||
|
||
@property | ||
def label(self) -> Label | None: | ||
"""The label that was added or removed from the issue. | ||
This is only available for the 'labeled' and 'unlabeled' events. | ||
""" | ||
return Label(self._payload["label"]) if self._payload.get("label") else None | ||
|
||
@property | ||
def milestone(self) -> Milestone | None: | ||
"""The milestone that was added to or removed from the issue. | ||
This is only available for the 'milestoned' and 'demilestoned' events. | ||
""" | ||
return Milestone(self._payload.get("milestone")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from github_contexts.github.payload.object.auto_merge import AutoMerge | ||
from github_contexts.github.payload.object.changes import ( | ||
IssueOpenedChanges, | ||
IssueTransferredChanges, | ||
IssueEditedChanges, | ||
PullRequestEditedChanges, | ||
IssueCommentEditedChanges, | ||
) | ||
from github_contexts.github.payload.object.comment import Comment | ||
from github_contexts.github.payload.object.commit import Commit | ||
from github_contexts.github.payload.object.commit_author import CommitAuthor | ||
from github_contexts.github.payload.object.head_base import HeadBase | ||
from github_contexts.github.payload.object.issue import Issue | ||
from github_contexts.github.payload.object.label import Label | ||
from github_contexts.github.payload.object.license import License | ||
from github_contexts.github.payload.object.milestone import Milestone | ||
from github_contexts.github.payload.object.performed_via_github_app import PerformedViaGitHubApp | ||
from github_contexts.github.payload.object.permissions import Permissions | ||
from github_contexts.github.payload.object.pull_request import PullRequest | ||
from github_contexts.github.payload.object.reactions import Reactions | ||
from github_contexts.github.payload.object.repository import Repository | ||
from github_contexts.github.payload.object.team import Team | ||
from github_contexts.github.payload.object.user import User |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../github/payloads/objects/commit_author.py → ...ts/github/payload/object/commit_author.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
class CommitAuthorObject: | ||
class CommitAuthor: | ||
|
||
def __init__(self, author: dict): | ||
self._author = author | ||
|
Oops, something went wrong.