Skip to content

Use http or https for GitHub Actions cache based on URL scheme - #1480

Open
maciejb wants to merge 1 commit into
google:mainfrom
maciejb:gha-cache-http-scheme
Open

Use http or https for GitHub Actions cache based on URL scheme#1480
maciejb wants to merge 1 commit into
google:mainfrom
maciejb:gha-cache-http-scheme

Conversation

@maciejb

@maciejb maciejb commented Aug 24, 2026

Copy link
Copy Markdown

Fixes #1479

Problem

request() always calls https.request(). Node throws ERR_INVALID_PROTOCOL when ACTIONS_RESULTS_URL is http://, before any socket is opened.

GitHub-hosted runners use HTTPS, so this never comes up there. Some third-party runners rewrite ACTIONS_RESULTS_URL to an http:// cache proxy. We hit this on Depot: wireit failed on the first cache lookup.

@actions/http-client already chooses the transport with parsedUrl.protocol === 'https:'.

Change

Parse the request URL and call http.request or https.request from the scheme. Nothing else about the cache API changes.

The fake GitHub cache server now skips TLS when no cert is passed, so a test can speak HTTP. Existing tests still pass a cert and stay on HTTPS.

Test plan

  • New fake-server test: HTTP ACTIONS_RESULTS_URL, two runs, second run is a cache hit (getBlob: 1, command not invoked again).
  • npm run test:cache-github-fake (26/26, including the existing HTTPS cases)

@google-cla

google-cla Bot commented Aug 24, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

https.request() throws ERR_INVALID_PROTOCOL when ACTIONS_RESULTS_URL is
http://, which some third-party runner cache proxies use.

Fixes google#1479
@maciejb
maciejb force-pushed the gha-cache-http-scheme branch from 5c978d9 to cc0487c Compare August 24, 2026 22:28
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.

GitHub Actions cache client rejects http:// ACTIONS_RESULTS_URL

1 participant