Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions tap_github/repository_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,49 @@ class ReviewCommentsStream(GitHubRestStream):
th.Property("side", th.StringType),
).to_dict()

def get_child_context(self, record: dict, context: Context | None) -> dict:
return {
"org": context["org"] if context else None,
"repo": context["repo"] if context else None,
"repo_id": context["repo_id"] if context else None,
"comment_id": record["id"] if context else None,
"comment_url": record["html_url"] if context else None,
}


class ReviewCommentReactionsStream(GitHubRestStream):
name = "review_comment_reactions"
path = "/repos/{org}/{repo}/pulls/comments/{comment_id}/reactions"
primary_keys: ClassVar[list[str]] = ["id"]
replication_key = "created_at"
parent_stream_type = ReviewCommentsStream
ignore_parent_replication_key = False
state_partitioning_keys: ClassVar[list[str]] = ["repo", "org"]

def post_process(self, row: dict, context: Context | None = None) -> dict:
row = super().post_process(row, context)

if context:
row["comment_id"] = context.get("comment_id")
row["comment_url"] = context.get("comment_url")

return row

schema = th.PropertiesList(
# Parent keys
th.Property("org", th.StringType),
th.Property("repo", th.StringType),
th.Property("repo_id", th.IntegerType),
th.Property("comment_id", th.IntegerType),
th.Property("comment_url", th.StringType),
# Reaction properties
th.Property("id", th.IntegerType),
th.Property("node_id", th.StringType),
th.Property("user", user_object),
th.Property("content", th.StringType),
th.Property("created_at", th.DateTimeType),
).to_dict()


class ContributorsStream(GitHubRestStream):
"""Defines 'Contributors' stream. Fetching User & Bot contributors."""
Expand Down
2 changes: 2 additions & 0 deletions tap_github/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
ReadmeStream,
ReleasesStream,
RepositoryStream,
ReviewCommentReactionsStream,
ReviewCommentsStream,
ReviewsStream,
StargazersGraphqlStream,
Expand Down Expand Up @@ -116,6 +117,7 @@ def __init__(self, valid_queries: set[str], streams: list[type[Stream]]) -> None
ReleasesStream,
ExtraMetricsStream,
RepositoryStream,
ReviewCommentReactionsStream,
ReviewCommentsStream,
ReviewsStream,
StargazersGraphqlStream,
Expand Down
Loading