Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gha): set correct full repo url #45

Merged
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
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()
)