@@ -2625,6 +2625,53 @@ class TagsStream(GitHubRestStream):
26252625 th .Property ("tarball_url" , th .StringType ),
26262626 th .Property ("node_id" , th .StringType ),
26272627 ).to_dict ()
2628+
2629+ def get_child_context (self , record : dict , context : dict | None ) -> dict :
2630+ """Return a child context object from the record and optional provided context.
2631+ By default, will return context if provided and otherwise the record dict.
2632+ Developers may override this behavior to send specific information to child
2633+ streams for context.
2634+ """
2635+ return {
2636+ "org" : context ["org" ] if context else None ,
2637+ "repo" : context ["repo" ] if context else None ,
2638+ "tag_name" : record ["name" ],
2639+ "repo_id" : context ["repo_id" ] if context else None ,
2640+ }
2641+
2642+ class GetTagShasStream (GitHubRestStream ):
2643+ """A stream dedicated to fetching tag shas of a tag in a repository.
2644+
2645+ API docs: https://docs.github.com/en/rest/git/refs#get-a-reference
2646+ """
2647+
2648+ name = "get_tag_shas"
2649+ path = "/repos/{org}/{repo}/git/ref/tags/{tag_name}"
2650+ primary_keys : ClassVar [list [str ]] = ["node_id" ]
2651+ parent_stream_type = TagsStream
2652+ ignore_parent_replication_key = True
2653+ state_partitioning_keys : ClassVar [list [str ]] = ["repo" , "org" , "tag_name" ]
2654+ tolerated_http_errors : ClassVar [list [int ]] = [404 ]
2655+
2656+ schema = th .PropertiesList (
2657+ # Parent Keys
2658+ th .Property ("repo" , th .StringType ),
2659+ th .Property ("org" , th .StringType ),
2660+ th .Property ("repo_id" , th .IntegerType ),
2661+ th .Property ("tag_name" , th .StringType ),
2662+ # Tag Sha Details
2663+ th .Property ("ref" , th .StringType ),
2664+ th .Property ("node_id" , th .StringType ),
2665+ th .Property ("url" , th .StringType ),
2666+ th .Property (
2667+ "object" ,
2668+ th .ObjectType (
2669+ th .Property ("type" , th .StringType ),
2670+ th .Property ("sha" , th .StringType ),
2671+ th .Property ("url" , th .StringType ),
2672+ ),
2673+ ),
2674+ ).to_dict ()
26282675
26292676
26302677class DeploymentsStream (GitHubRestStream ):
0 commit comments