Title: fix(ci-info): detect GitHub Actions before presence-only CI providers [SDK-7081] by osho-20 · Pull Request #1154 · browserstack/browserstack-cypress-cli · GitHub
Open Graph Title: fix(ci-info): detect GitHub Actions before presence-only CI providers [SDK-7081] by osho-20 · Pull Request #1154 · browserstack/browserstack-cypress-cli
X Title: fix(ci-info): detect GitHub Actions before presence-only CI providers [SDK-7081] by osho-20 · Pull Request #1154 · browserstack/browserstack-cypress-cli
Description: Problem
SDK-7081 — TRA's Re-run control is missing on some of a customer's Cypress builds. obs-api computes the reRun flag per build and force-disables it when the build has no CI build_url; the TRA frontend greys the control off that flag.
In getCiInfo() (bin/helpers/helper.js) the Jenkins check runs first and matches on the mere presence of JENKINS_URL/JENKINS_HOME. On a self-hosted GitHub Actions runner with leftover Jenkins env vars (the customer runs runs-on: [self-hosted, ...]), the build is classified as Jenkins:
{"name": "Jenkins"}
build_url/job_name/build_number are all undefined (Jenkins vars like BUILD_URL aren't set), so the serialized ci_info reaches TestHub without a build_url → re-run permanently greyed for that build — even on the latest CLI.
Note: the customer's currently-affected workflows also pin pre-1.36.5 CLI versions (no GHA detection at all → ci_info: null, same gate). That part is resolved by upgrading the pins to ≥ 1.36.10; this PR closes the remaining variant that can hit current versions.
Fix
Move the GitHub Actions branch — keyed on the explicit GITHUB_ACTIONS === "true" marker — ahead of the presence-only providers. Explicit CI markers now win over incidental env leftovers.
Also: getGitMetaData() now returns after resolve({}) when no git directory is found, instead of falling through and attempting a second resolve.
Scope
Detection order only — every provider's returned fields are unchanged. Pure-Jenkins environments (no GITHUB_ACTIONS/GITHUB_RUN_ID) still resolve to Jenkins. Complements #1123 (SDK-6279), which fixed build_number in the same branch.
Verification
getCiInfo() under env-faithful GitHub Actions vars plus a leaked JENKINS_HOME=/var/lib/jenkins:
State
Result
Before
{"name":"Jenkins"} — no build_url → re-run greyed
After
{"name":"GitHub Actions","build_url":".../actions/runs/27412345678","build_number":"27412345678"}
New unit tests in test/unit/bin/helpers/helper.js: GHA detection, the Jenkins-shadowing regression, pure Jenkins, no-CI — all pass.
Full suite: 693 passing / 16 failing — the 16 failures are pre-existing on master (verified identical with the change stashed).
End-to-end repro of the gate on real builds (identical suite + GHA env, only CLI version differs): TRA build xa9qkg059unqm0s76mshuadvsiphhdcfbqdafurc (ci_info: null, CLI 1.36.3) vs jl1fvypsbnpeq01viexykee0fdfnxlcye4kuctk3 (ci_info populated, CLI 1.36.13), confirmed via GET /ext/v1/builds/
Open Graph Description: Problem SDK-7081 — TRA's Re-run control is missing on some of a customer's Cypress builds. obs-api computes the reRun flag per build and force-disables it when the build has no CI build_url...
X Description: Problem SDK-7081 — TRA's Re-run control is missing on some of a customer's Cypress builds. obs-api computes the reRun flag per build and force-disables it when the build has no CI b...
Opengraph URL: https://github.com/browserstack/browserstack-cypress-cli/pull/1154
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:54d56fd7-3f64-61fc-04e6-8ec1f4869af3 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BFFC:3FCD63:300017:428583:6B0455AF |
| html-safe-nonce | fc07f14952c5a19c437f69379b361470c547a4d12aeafc23deb737ddf66acce9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkZDOjNGQ0Q2MzozMDAwMTc6NDI4NTgzOjZCMDQ1NUFGIiwidmlzaXRvcl9pZCI6IjYwNzM2NjQ4NzYwMDQ1Mjk1ODMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8c61efee49ec0a7da7ab1be94fa2541896636c5c726e235fa460a0930eae5edd |
| hovercard-subject-tag | pull_request:4142706275 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/browserstack/browserstack-cypress-cli/pull/1154/files |
| twitter:image | https://avatars.githubusercontent.com/u/76126720?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/76126720?s=400&v=4 |
| og:image:alt | Problem SDK-7081 — TRA's Re-run control is missing on some of a customer's Cypress builds. obs-api computes the reRun flag per build and force-disables it when the build has no CI build_url... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 910ca0e260cfec6aff11407d8dc6a0d3a4cd381a2ec9ada56627b063426892a0 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/browserstack/browserstack-cypress-cli git https://github.com/browserstack/browserstack-cypress-cli.git |
| octolytics-dimension-user_id | 1119453 |
| octolytics-dimension-user_login | browserstack |
| octolytics-dimension-repository_id | 242935045 |
| octolytics-dimension-repository_nwo | browserstack/browserstack-cypress-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 242935045 |
| octolytics-dimension-repository_network_root_nwo | browserstack/browserstack-cypress-cli |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e086f9b7e88322eb2b41885a6ad425b215737fa5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width