This repository was archived by the owner on Aug 24, 2026. It is now read-only.
Omit run URL when GITHUB_REPOSITORY or GITHUB_RUN_ID is absent - #132
Merged
pda merged 1 commit intoAug 20, 2026
Merged
Conversation
_github_actions_env builds the URL with an f-string over two values that
_get_env can legitimately return as None. When either is missing, the
interpolation produces the literal string 'None' inside the URL:
https://github.com/None/actions/runs/None
That value is then a non-None string, so as_json() keeps it and sends it to
the API instead of omitting the field.
The other two CI branches do not have this problem. _buildkite_env and
_circle_ci_env pass _get_env(...) straight through, so a missing value stays
None and as_json() filters it out. This brings the GitHub Actions branch in
line with them.
The guard clause above only requires GITHUB_ACTION, GITHUB_RUN_NUMBER and
GITHUB_RUN_ATTEMPT, so reaching this code with either of the other two unset
is possible — most plausibly through RunEnvBuilder's documented injected
environment, or a runner with a trimmed environment.
Adds a regression test that fails on the current code with the 'None' URL and
passes with the change.
pda
approved these changes
Aug 20, 2026
pda
pushed a commit
to buildkite/test-collector-javascript
that referenced
this pull request
Aug 24, 2026
github_actions() builds the URL with a template literal over two environment
variables that may be undefined. Interpolating undefined yields the literal
string 'undefined', so the result is:
https://github.com/undefined/actions/runs/undefined
That is a real string rather than undefined, so JSON.stringify keeps it and
it is sent as though it were a genuine URL.
ci_env() enters this branch on GITHUB_RUN_NUMBER alone, so the other two
variables are not guaranteed. The existing test 'uses github action
environment variables second' already exercises this exact path — it sets
only GITHUB_RUN_NUMBER — but asserts only on ci.
buildkite() and circleci() are unaffected: they assign process.env values
directly, so a missing variable stays undefined and JSON.stringify drops the
key. This brings github_actions() in line with them.
Same defect as buildkite/test-collector-python#132.
Adds a regression test that fails on the current code and passes with the
change.
pda
added a commit
to buildkite/bktest
that referenced
this pull request
Aug 24, 2026
…kite/test-collector-python#132) _github_actions_env builds the URL with an f-string over two values that _get_env can legitimately return as None. When either is missing, the interpolation produces the literal string 'None' inside the URL: https://github.com/None/actions/runs/None That value is then a non-None string, so as_json() keeps it and sends it to the API instead of omitting the field. The other two CI branches do not have this problem. _buildkite_env and _circle_ci_env pass _get_env(...) straight through, so a missing value stays None and as_json() filters it out. This brings the GitHub Actions branch in line with them. The guard clause above only requires GITHUB_ACTION, GITHUB_RUN_NUMBER and GITHUB_RUN_ATTEMPT, so reaching this code with either of the other two unset is possible — most plausibly through RunEnvBuilder's documented injected environment, or a runner with a trimmed environment. Adds a regression test that fails on the current code with the 'None' URL and passes with the change. Co-authored-by: SirHegel <SirHegel@users.noreply.github.com>
pda
pushed a commit
to buildkite/bktest
that referenced
this pull request
Aug 24, 2026
github_actions() builds the URL with a template literal over two environment
variables that may be undefined. Interpolating undefined yields the literal
string 'undefined', so the result is:
https://github.com/undefined/actions/runs/undefined
That is a real string rather than undefined, so JSON.stringify keeps it and
it is sent as though it were a genuine URL.
ci_env() enters this branch on GITHUB_RUN_NUMBER alone, so the other two
variables are not guaranteed. The existing test 'uses github action
environment variables second' already exercises this exact path — it sets
only GITHUB_RUN_NUMBER — but asserts only on ci.
buildkite() and circleci() are unaffected: they assign process.env values
directly, so a missing variable stays undefined and JSON.stringify drops the
key. This brings github_actions() in line with them.
Same defect as buildkite/test-collector-python#132.
Adds a regression test that fails on the current code and passes with the
change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
_github_actions_envbuilds the run URL with an f-string over two values that_get_envcan legitimately return asNone:When either is missing, the interpolation produces the literal string
Noneinside the URL:That value is a non-
Nonestring, soas_json()keeps it — the filter isif v is not None— and the malformed URL is sent to the API rather than the field being omitted.Why the other branches are unaffected
_buildkite_envand_circle_ci_envpass_get_env(...)straight through:so a missing value stays
Noneandas_json()drops the key. This change brings the GitHub Actions branch in line with them.How it is reachable
The guard clause above only requires
GITHUB_ACTION,GITHUB_RUN_NUMBERandGITHUB_RUN_ATTEMPT. NeitherGITHUB_REPOSITORYnorGITHUB_RUN_IDis checked, so the branch can be entered with either unset — most plausibly throughRunEnvBuilder's injected environment, which the class docstring documents as a supported use, or on a runner with a trimmed environment.Reproduced against the current code:
The change
Build the URL only when both parts are present; otherwise leave it
Noneand letas_json()omit it, exactly as the other two branches already do.Tests
Added a regression test that fails on the current code with the
NoneURL and passes with the change. Full suite: 117 passed, 1 skipped.