diff --git a/GITEA-PATCH.md b/GITEA-PATCH.md new file mode 100644 index 0000000..5b0266c --- /dev/null +++ b/GITEA-PATCH.md @@ -0,0 +1,60 @@ +# The Gitea patch + +A fork of `actions/upload-artifact` with one thing changed, kept here because +the upstream action refuses to run on Gitea and the refusal cannot be undone +from a workflow. + +## What was changed + +`isGhes()` in the bundles — `dist/upload/index.js` and `dist/merge/index.js` — +returns `false` instead of deciding by the host: + +```js +function isGhes() { + ... + return false; // was: !isGitHubHost && !isGheHost && !isLocalHost +} +``` + +Nothing else. The sources under `src/` are untouched: the function comes from +`@actions/artifact`, which is bundled into `dist/` at build time, and `dist/` is +what the runner executes. + +## Why + +The action reads `GITHUB_SERVER_URL`, and anything that is neither `github.com` +nor a host ending in `.ghe.com` or `.localhost` it takes for a GitHub Enterprise +Server, where the v4 artifact backend does not exist. It then throws +`GHESNotSupportedError` before making a single request. + +For Gitea the verdict is wrong: the v4 protocol is implemented and answers the +very requests the action makes — artifacts uploaded this way sit in the storage +already. But the check runs on the runner, ahead of the network, so a working +backend never gets a chance to prove itself. Nor can the name be corrected from +the workflow: the runner sets the `GITHUB_` ones over whatever a step puts in +its `env`, which a probe run confirmed. + +Hence the fork. The alternative was `upload-artifact@v3`, which asks nothing +about the host and still works on Gitea — but GitHub shut its own v3 artifact +backend down in January 2025, and Gitea may well follow. + +## Upstream + +Forked from `actions/upload-artifact` at tag `v4`, commit +`ea165f8d65b6e75b540449e92b4886f43607fa02` (v4.6.2, 19 March 2025). + +To move to a newer upstream: fetch it, rebase or re-apply this one change to +both bundles, and move the tag. Grep for `isGitHubHost` — if it is gone, the +check has been rewritten and this file needs rereading rather than repeating. + +## How it is used + +Referenced by full URL, so nothing resolves it against github.com: + +```yaml +uses: https://git.alrakis.kz/actions/upload-artifact@v4-gitea +``` + +The tag is fixed on purpose. A floating one is how the release broke in the +first place: the action is fetched over the network at run time, and what +arrives can change without anything in the repository changing. diff --git a/dist/merge/index.js b/dist/merge/index.js index eabca8a..fe426c5 100644 --- a/dist/merge/index.js +++ b/dist/merge/index.js @@ -2903,7 +2903,10 @@ function isGhes() { const isGitHubHost = hostname === 'GITHUB.COM'; const isGheHost = hostname.endsWith('.GHE.COM'); const isLocalHost = hostname.endsWith('.LOCALHOST'); - return !isGitHubHost && !isGheHost && !isLocalHost; + // Patched for Gitea. The host is neither github.com nor an enterprise one, + // and the check would turn the upload down before it made a request — see + // GITEA-PATCH.md + return false; } exports.isGhes = isGhes; function getGitHubWorkspaceDir() { diff --git a/dist/upload/index.js b/dist/upload/index.js index 89238fa..4b13804 100644 --- a/dist/upload/index.js +++ b/dist/upload/index.js @@ -2903,7 +2903,10 @@ function isGhes() { const isGitHubHost = hostname === 'GITHUB.COM'; const isGheHost = hostname.endsWith('.GHE.COM'); const isLocalHost = hostname.endsWith('.LOCALHOST'); - return !isGitHubHost && !isGheHost && !isLocalHost; + // Patched for Gitea. The host is neither github.com nor an enterprise one, + // and the check would turn the upload down before it made a request — see + // GITEA-PATCH.md + return false; } exports.isGhes = isGhes; function getGitHubWorkspaceDir() {