Use http or https for GitHub Actions cache based on URL scheme - #1480
Open
maciejb wants to merge 1 commit into
Open
Use http or https for GitHub Actions cache based on URL scheme#1480maciejb wants to merge 1 commit into
maciejb wants to merge 1 commit into
Conversation
|
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
force-pushed
the
gha-cache-http-scheme
branch
from
August 24, 2026 22:28
5c978d9 to
cc0487c
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1479
Problem
request()always callshttps.request(). Node throwsERR_INVALID_PROTOCOLwhenACTIONS_RESULTS_URLishttp://, before any socket is opened.GitHub-hosted runners use HTTPS, so this never comes up there. Some third-party runners rewrite
ACTIONS_RESULTS_URLto anhttp://cache proxy. We hit this on Depot: wireit failed on the first cache lookup.@actions/http-clientalready chooses the transport withparsedUrl.protocol === 'https:'.Change
Parse the request URL and call
http.requestorhttps.requestfrom 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
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)