Skip to content

Commit

Permalink
fix(gha): set correct full repo url (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
jd authored Jan 7, 2025
1 parent debe381 commit 9c875b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pytest_mergify/resources/github_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def detect(self) -> Resource:

if "GITHUB_SERVER_URL" in os.environ and "GITHUB_REPOSITORY" in os.environ:
attributes[vcs_attributes.VCS_REPOSITORY_URL_FULL] = (
os.environ["GITHUB_SERVER_URL"] + os.environ["GITHUB_REPOSITORY"]
os.environ["GITHUB_SERVER_URL"] + "/" + os.environ["GITHUB_REPOSITORY"]
)

for attribute_name, envvar in self.OPENTELEMETRY_GHA_MAPPING.items():
Expand Down
6 changes: 6 additions & 0 deletions tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ def test_span_github_actions(
# Do a partial reconfig, half GHA, half local to have spans
monkeypatch.setenv("GITHUB_ACTIONS", "true")
monkeypatch.setenv("GITHUB_REPOSITORY", "Mergifyio/pytest-mergify")
monkeypatch.setenv("GITHUB_SERVER_URL", "https://github.com")
result, spans = pytester_with_spans()
assert all(
span.resource.attributes["vcs.repository.name"] == "Mergifyio/pytest-mergify"
for span in spans.values()
)
assert all(
span.resource.attributes["vcs.repository.url.full"]
== "https://github.com/Mergifyio/pytest-mergify"
for span in spans.values()
)

0 comments on commit 9c875b3

Please sign in to comment.