fix(internal): vendor-aware GHES detection in isGhes() to support non-GitHub servers - #2123
fix(internal): vendor-aware GHES detection in isGhes() to support non-GitHub servers#2123MahdiBaghbani wants to merge 1 commit into
Conversation
|
Could this be inplemented? I believe that customizing the isGhes function no longer works? |
|
The toolkit/packages/cache/src/internal/config.ts Lines 14 to 20 in 50ee743 |
Signed-off-by: Mahdi Baghbani <mahdi-baghbani@azadehafzar.io>
6e3a7ad to
87cd75c
Compare
|
@DaanSelen yes, this is still worth doing, and I just force-pushed a reworked commit that changes the approach. To your point about customizing The new commit fixes it at the source: |
|
@silverwind agreed that With the new commit, I want to be honest about the tradeoff, because it is not free. Gitea I think honoring the flag is still the correct behavior: the toolkit should not be second-guessing a runner-provided signal, and the remaining gap is a forge-side implementation detail rather than a misclassification in this library. I documented this tradeoff in a comment at the top of the cache config so it is not a surprise. If you would prefer the toolkit keep a safety net for forges that advertise v2 without a backend, that is a separate design decision and I am happy to discuss it. |
|
@camjay @philip-gai following the discussion on #2438, a quick note on how this PR relates. #2438 unblocks the v2 artifact backend on GHES 3.13+ by consulting Happy to adjust if you see any overlap or risk I missed. |
We implement v2 CacheService now with https://gitea.com/gitea/runner/pulls/1110 which includes a runtime patch that disables I don't think the maintainers here will accept a check targeting non-github runners and therefor I still ask to remove |
Introduce a minimal, explicit vendor switch to prevent
isGhes()from misclassifying non GitHub platforms (e.g., Forgejo/Gitea) as GHES, This PR adds a positive allowlist for GHES aliases and preserves current behavior for github.On self-hosted non-GitHub servers, the current heuristic (
GITHUB_SERVER_URL hostname) often evaluates toenterprisesending actions down GHES specific code paths and causing failures.A tiny, explicit environment switch avoids this without changing default behavior on GitHub
for reference when this breaks other platforms please see:
actions/upload-artifact#676
https://code.forgejo.org/actions/upload-artifact
https://code.forgejo.org/forgejo/runner/src/branch/main/RELEASE-NOTES.md#3-4-0
go-gitea/gitea#31256
The workaround right now is:
https://gitea.com/actions/gitea-upload-artifact/commit/81f940d004763f986ba3582c007fd842dd5cb0d7
https://code.forgejo.org/forgejo/upload-artifact/commit/16871d9e8cfcf27ff31822cac382bbb5450f1e1e
Update (2026-07-31): reworked the approach. The current commit makes
isGhes()forge-aware directly instead of relying on anACTIONS_VENDORallowlist.FORGEJO_ACTIONSorGITEA_ACTIONS,isGhes()returns false. This is the forge-provided signal and fixes Forgejo and Gitea automatically.ACTIONS_VENDORis kept only as an optional, corrected escape hatch:githubforces false,ghesforces true, unknown values fall through to the hostname heuristic (a typo or spoofed value cannot silently disable the GHES block). The buggyghe/github-enterprisealiases are gone (they collided with*.ghe.com, which is GitHub Enterprise Cloud, not GHES).github.com,*.ghe.com,*.localhost) is unchanged, so real GHES with no forge flags still returns true and artifact v4 stays blocked there as before.isGhes()does not consultACTIONS_RESULTS_URL.Accepted tradeoffs, documented in
packages/cache/src/internal/config.ts: on forges the cache client now honorsACTIONS_CACHE_SERVICE_V2(which can 404 until forges implement the v2 CacheService, see go-gitea/gitea#33393), and the client-side 10GB cache cap becomes active on forges.