Skip to content

bug: only require CI=true and AccessToken when making API requests#1278

Merged
burmudar merged 8 commits intomainfrom
wb/bug-src-token-and-ci
Mar 26, 2026
Merged

bug: only require CI=true and AccessToken when making API requests#1278
burmudar merged 8 commits intomainfrom
wb/bug-src-token-and-ci

Conversation

@burmudar
Copy link
Contributor

@burmudar burmudar commented Mar 25, 2026

In https://github.com/sourcegraph/sourcegraph/actions/runs/23518169374/job/68455311352?pr=11118 the action failed on command src version -client-only, where it should not have failed because it's a client only check and no API interaction thus not requiring a Access Token to be set.

In this PR we update the config:

  • record whether we are in CI

Update APIClient:

  • add a check to see if we're in CI and our AuthMode is "AccessToken"
  • fail on any request if we require a CI AccessToken and it is not set.

Closes CPL-291

Test plan

unit tests + manual tests

@burmudar burmudar requested a review from a team March 25, 2026 08:15
@burmudar burmudar self-assigned this Mar 25, 2026
- rename `RequireAccessToken` to `checkIfCIAccessTokenRequired`
- provide more context in error on why it happened
@burmudar burmudar force-pushed the wb/bug-src-token-and-ci branch from e6c2532 to cd32acb Compare March 25, 2026 14:16
@burmudar burmudar merged commit 0e5e006 into main Mar 26, 2026
9 checks passed
@burmudar burmudar deleted the wb/bug-src-token-and-ci branch March 26, 2026 09:49
burmudar added a commit that referenced this pull request Mar 26, 2026
…1278)

* check when inCI and whether we required Access Token

* fast fail in APIClient when CI=true and no Access Token

* use apiClient constructor in search_jobs

* fail fast in login / auth token when CI=true and AccessToken not set

* add comment

* review feedback

- rename `RequireAccessToken` to `checkIfCIAccessTokenRequired`
- provide more context in error on why it happened

* use sentinel error

* use lib errors

(cherry picked from commit 0e5e006)
burmudar added a commit that referenced this pull request Mar 26, 2026
…1278)

* check when inCI and whether we required Access Token

* fast fail in APIClient when CI=true and no Access Token

* use apiClient constructor in search_jobs

* fail fast in login / auth token when CI=true and AccessToken not set

* add comment

* review feedback

- rename `RequireAccessToken` to `checkIfCIAccessTokenRequired`
- provide more context in error on why it happened

* use sentinel error

* use lib errors

(cherry picked from commit 0e5e006)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants