let the action run on Gitea
Check dist/ / check-dist (push) Canceled after 0s
Code scanning - action / CodeQL-Build (push) Canceled after 0s
Licensed / Check licenses (push) Canceled after 0s
Test / Build (macos-latest) (push) Canceled after 0s
Test / Build (ubuntu-latest) (push) Canceled after 0s
Test / Build (windows-latest) (push) Canceled after 0s
Test / Merge (push) Canceled after 0s
Check dist/ / check-dist (push) Canceled after 0s
Code scanning - action / CodeQL-Build (push) Canceled after 0s
Licensed / Check licenses (push) Canceled after 0s
Test / Build (macos-latest) (push) Canceled after 0s
Test / Build (ubuntu-latest) (push) Canceled after 0s
Test / Build (windows-latest) (push) Canceled after 0s
Test / Merge (push) Canceled after 0s
isGhes() reads GITHUB_SERVER_URL and takes every host but github.com and its enterprise ones for a GHES, where the v4 artifact backend is absent. On Gitea that backend is there and answers, but the check runs on the runner ahead of any request, so the upload never starts. It now returns false. See GITEA-PATCH.md. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
ea165f8d65
commit
2ea74c0637
@@ -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.
|
||||
Reference in New Issue
Block a user