@@ -43,6 +43,7 @@ class PytestMergify:
4343 __name__ = "PytestMergify"
4444
4545 exporter : export .SpanExporter
46+ repo_name : str | None
4647
4748 def ci_supports_trace_interception (self ) -> bool :
4849 return utils .get_ci_provider () == "github_actions"
@@ -51,6 +52,7 @@ def ci_supports_trace_interception(self) -> bool:
5152 @pytest .hookimpl (trylast = True )
5253 def pytest_configure (self , config : _pytest .config .Config ) -> None :
5354 self .token = os .environ .get ("MERGIFY_TOKEN" )
55+ self .repo_name = utils .get_repository_name ()
5456
5557 span_processor : opentelemetry .sdk .trace .SpanProcessor
5658 if os .environ .get ("PYTEST_MERGIFY_DEBUG" ):
@@ -67,11 +69,12 @@ def pytest_configure(self, config: _pytest.config.Config) -> None:
6769 url = config .getoption ("--mergify-api-url" ) or os .environ .get (
6870 "MERGIFY_API_URL" , "https://api.mergify.com"
6971 )
70- self .exporter = OTLPSpanExporter (
71- endpoint = f"{ url } /v1/ci/traces" ,
72- headers = {"Authorization" : f"Bearer { self .token } " },
73- compression = Compression .Gzip ,
74- )
72+ if self .repo_name is not None :
73+ self .exporter = OTLPSpanExporter (
74+ endpoint = f"{ url } /v1/{ self .repo_name } /ci/traces" ,
75+ headers = {"Authorization" : f"Bearer { self .token } " },
76+ compression = Compression .Gzip ,
77+ )
7578 span_processor = export .BatchSpanProcessor (self .exporter )
7679 else :
7780 return
0 commit comments