Commit Graph

112 Commits

Author SHA1 Message Date
Michael B. Gale
8dfe937b99 Use wrapApiConfigurationError for getGitHubVersionFromApi 2026-09-25 18:14:47 +01:00
Michael B. Gale
8102666a8c Improve return type for wrapApiConfigurationError and add docs 2026-09-25 18:12:23 +01:00
Michael B. Gale
9fb2fa5f46 Avoid duplicate getApiDetails in getGitHubVersion 2026-09-25 15:02:13 +01:00
Henry Mercer
1bcdd0c019 Derive the API client type from @actions/github
`ApiClient` was hand-composed from `Octokit`, `Api` and `PaginateInterface`, imported directly from separately versioned Octokit packages. That asserted a shape matching what `@actions/github` actually returns, which held only while the versions happened to agree.

`@octokit/plugin-rest-endpoint-methods` v18 adds twelve Actions cache-limit methods. `@actions/github` still depends on `^17.0.0`, so the client it constructs no longer satisfies the v18-derived alias and the build fails.

Deriving the type from the constructor removes the assumption, so the alias tracks whatever `@actions/github` returns.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-27 18:56:47 +01:00
Michael B. Gale
909828cd53 Base custom request options on defaults, and add basic tests for makeProxyRequestOptions 2026-07-22 07:10:41 +01:00
Michael B. Gale
3b5ee58597 Use default request options instead of undefined 2026-07-22 05:55:30 +01:00
Michael B. Gale
7db34ae6f4 Refactor looking up proxy env vars into getRegistryProxyConfig.
This makes that function testable.
2026-07-17 13:48:49 +01:00
Michael B. Gale
8125f87336 Remove unused getApiFetch 2026-07-16 21:34:10 +01:00
Michael B. Gale
7b19180f8d Merge remote-tracking branch 'origin/main' into mbg/use-registry-proxy-for-repo-auth 2026-07-16 12:48:24 +01:00
Michael B. Gale
47e9c29998 Log whether the proxy is picked up on 2026-07-14 17:02:07 +01:00
Michael B. Gale
205b37b035 Use ActionState for getRegistryProxy 2026-07-14 16:17:51 +01:00
Michael B. Gale
80599cc5d9 Allow proxy to be threaded into createApiClientWithDetails
This will make it easier to gate the `getRegistryProxy` with a FF,
without the significant refactoring that is needed to thread the FFs
into `createApiClientWithDetails`
2026-07-14 16:07:08 +01:00
Michael B. Gale
1542951d09 Type the API client 2026-07-14 10:09:03 +01:00
Michael B. Gale
a29dee455c Add minimal proxy init code 2026-07-13 16:15:58 +01:00
Michael B. Gale
a440e35eda Move ActionsEnvVars to environment.ts 2026-07-09 12:48:49 +01:00
Michael B. Gale
732911a2fa Turn Env into a class, and add ReadOnlyEnv 2026-07-09 12:38:40 +01:00
Michael B. Gale
5e3e6b81b9 Add ActionsEnvVars enum 2026-07-06 12:27:26 +01:00
Henry Mercer
6feed5452f Categorize Code Quality "not enabled" upload failure as user-error
When a repository requests Code Quality analysis but it is not enabled,
the SARIF upload to `PUT /repos/:owner/:repo/code-quality/analysis`
returns a 403 with the message "Code quality is not enabled for this
repository...". `isEnablementError` did not recognize this wording, so
`wrapApiConfigurationError` left it as a plain Error and the analyze job
was reported with `status=failure` instead of `user-error`.

Add a `/Code Quality is not enabled/i` pattern so the error becomes a
ConfigurationError and `getActionsStatus` categorizes it as `user-error`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-23 16:23:41 +01:00
Henry Mercer
f64a4491cf Add links to API docs 2026-05-05 18:48:09 +01:00
Henry Mercer
5997e25ad9 Update listActionsCaches doc 2026-05-05 18:43:01 +01:00
Henry Mercer
7587714d0a Revert "Mitigate caches being evicted before they can be downloaded"
This reverts commit 1279e8d41c.
2026-05-05 18:37:17 +01:00
Henry Mercer
1279e8d41c Mitigate caches being evicted before they can be downloaded 2026-04-22 00:04:57 +01:00
Henry Mercer
13c548978d Fix retries when uploading databases 2026-03-10 12:34:18 +00:00
Henry Mercer
43b46a19be Retry API authentication errors since these can be transient 2026-02-12 16:19:04 +00:00
Henry Mercer
6d4cd5d744 Add "Requires authentication" to wrapApiConfigurationError 2026-02-02 18:02:11 +00:00
Michael B. Gale
d5b3d42fd4 Inline EnvVar.ANALYSIS_KEY in getAnalysisKey 2026-01-21 12:52:24 +00:00
Michael B. Gale
055e6b6f36 Add EnvVar constant for analysis key 2026-01-19 13:41:38 +00:00
Henry Mercer
1fc7d3785d Rename GHE_DOTCOM to GHEC_DR
This more closely reflects the published naming https://docs.github.com/en/enterprise-cloud@latest/admin/data-residency/about-github-enterprise-cloud-with-data-residency
2025-12-10 17:41:19 +00:00
Henry Mercer
cac5926de5 Delete unused exports 2025-11-18 18:16:54 +00:00
Michael B. Gale
f0e9bf07f4 Make isEnablementError case-insensitive 2025-10-30 11:37:07 +00:00
Michael B. Gale
52a7bd7b6e Check for 403 status 2025-10-29 08:35:19 +00:00
Michael B. Gale
194ba0ee2d Make error message tests less brittle 2025-10-29 08:29:11 +00:00
Michael B. Gale
53acf0b8aa Turn enablement errors into configuration errors 2025-10-28 21:17:30 +00:00
Henry Mercer
3d988b275a Pass minimal copy of core 2025-10-28 16:33:21 +00:00
Henry Mercer
8b1e55d11e Use Actions logger in API client
This allows us to remove the `console-log-level` dependency.
2025-10-28 12:15:03 +00:00
Henry Mercer
e6e649a8f3 Simplify API error checks 2025-10-21 10:31:53 +01:00
Henry Mercer
c64c4070cc Handle HTTP errors with httpStatusCode property 2025-10-20 14:38:02 +01:00
Michael B. Gale
e6768a18cf Merge branch 'main' into mbg/dep-caching/telemetry 2025-09-29 08:39:48 +01:00
Michael B. Gale
6ccec2ac14 Remove url from log messages 2025-09-24 18:54:49 +01:00
Michael B. Gale
4e820a4ca4 Apply review feedback 2025-09-24 15:50:19 +01:00
Michael B. Gale
efcf614b5d Refactor assembling Authorization header value into its own function 2025-09-24 12:40:15 +01:00
Michael B. Gale
7dfbfdcb01 Report overall cache usage for CodeQL dependency caches 2025-09-23 12:28:42 +01:00
Michael B. Gale
40262b1861 Add getRepositoryProperties to api-client, for easier mocking 2025-09-23 09:11:10 +01:00
Fotis Koutoulakis (@NlightNFotis)
55ee663d5f review-comments: refactor getActionsStatus to accept an extra parameter designating if the analysis is third-party 2025-04-01 14:58:59 +01:00
Fotis Koutoulakis (@NlightNFotis)
a022653e2d feat: classify more HTTP errors as configuration errors in api-client 2025-03-31 11:54:16 +01:00
Fotis Koutoulakis (@NlightNFotis)
73c938dbc0 fix: fix issue where wrapApiConfigurationError would fail to regex match a string due to boundary constraints on the regex 2025-03-28 14:38:06 +00:00
Chuan-kai Lin
f88459c0a3 Use getRepositoryNwo() 2025-03-26 10:18:40 -07:00
nickfyson
7b7ed63503 adjust string for handling rate limit error 2025-03-06 10:33:25 +00:00
Marco Gario
ddd849e831 fix lint 2024-07-01 12:14:01 +00:00
Marco Gario
0ff1bdba7f Update src/api-client.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2024-07-01 11:01:12 +02:00