Skip to content

Commit

Permalink
fix(gha): set correct full repo url
Browse files Browse the repository at this point in the history
Change-Id: I85863a95443f252686fe7a0014ed7d09850dde61
  • Loading branch information
jd committed Jan 6, 2025
1 parent debe381 commit ca5e2c9
Show file tree
Hide file tree
Showing 2 changed files with 6 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
5 changes: 5 additions & 0 deletions tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ 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 ca5e2c9

Please sign in to comment.