Skip to content

Feature non-zipped actions artifacts (action v7 / nodejs / npm v6.2.0)#36786

Merged
wxiaoguang merged 85 commits into
go-gitea:mainfrom
ChristopherHX:non-zip-artifacts
Mar 25, 2026
Merged

Feature non-zipped actions artifacts (action v7 / nodejs / npm v6.2.0)#36786
wxiaoguang merged 85 commits into
go-gitea:mainfrom
ChristopherHX:non-zip-artifacts

Conversation

@ChristopherHX
Copy link
Copy Markdown
Contributor

@ChristopherHX ChristopherHX commented Feb 28, 2026

  • content_encoding contains a slash => v4 artifact
  • updated proto files to support mime_type and no longer return errors for upload-artifact v7
  • json and txt files are now previewed in browser
  • normalized content-disposition header creation
  • azure blob storage uploads directly in servedirect mode (no proxying data)
  • normalize content-disposition headers based on go mime package
    • getting both filename and filename* encoding is done via custom code

Closes #36829


@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 28, 2026
@ChristopherHX ChristopherHX added type/feature Completely new functionality. Can only be merged if feature freeze is not active. topic/gitea-actions related to the actions of Gitea labels Feb 28, 2026
Signed-off-by: ChristopherHX <christopher.homberger@web.de>
@ChristopherHX
Copy link
Copy Markdown
Contributor Author

GITHUB_SERVER_URL hack + @actions/artifact can be used like

           const { default: artifact } = await import("@actions/artifact");
           var artifactName = "my-single-file";
           process.env.GITHUB_SERVER_URL = "https://github.com" // Escape isGHES bomb
           var uploadResult = await artifact.uploadArtifact(
             artifactName,
             ['package.json'],
             './',
             {skipArchive: true}
           )

Comment thread routers/web/repo/actions/view.go Outdated
Comment thread routers/api/actions/artifactsv4.go
…n the code and fixed it later by changing the other end
Comment thread modules/actions/artifacts.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread modules/storage/storage.go Outdated
Comment thread modules/httplib/serve.go Outdated
Comment thread services/repository/archiver/archiver.go
Comment thread routers/web/repo/actions/view.go Outdated
Comment thread routers/api/actions/artifactsv4.go Outdated
@wxiaoguang wxiaoguang marked this pull request as ready for review March 25, 2026 11:23
Copy link
Copy Markdown
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough now?

@ChristopherHX
Copy link
Copy Markdown
Contributor Author

Is it ok to set charset to every file type?

    --- FAIL: TestActionsArtifactV4DownloadSingle/Download-Zip (0.01s)
        api_actions_artifact_v4_test.go:586: 
            	Error Trace:	/home/runner/work/gitea/gitea/tests/integration/api_actions_artifact_v4_test.go:586
            	Error:      	Not equal: 
            	            	expected: "application/zip"
            	            	actual  : "application/zip; charset=utf-8"
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-application/zip
            	            	+application/zip; charset=utf-8
            	Test:       	TestActionsArtifactV4DownloadSingle/Download-Zip

for text types in the test good point, but otherwise?

@wxiaoguang
Copy link
Copy Markdown
Contributor

Is it ok to set charset to every file type?

Bug, fixed in new commit

@wxiaoguang
Copy link
Copy Markdown
Contributor

Found more problems in the "httplib.ServeXxx" functions, fixed together.

@ChristopherHX
Copy link
Copy Markdown
Contributor Author

Are you sure we should do something like this:

func (b *Base) SetServeHeaders(opt *ServeHeaderOptions) {
	httplib.ServeSetHeaders(b.Resp, *(*httplib.ServeHeaderOptions)(opt))
}

// ServeContent serves content to http request
func (b *Base) ServeContent(r io.ReadSeeker, opts *ServeHeaderOptions) {
	httplib.ServeSetHeaders(b.Resp, *(*httplib.ServeHeaderOptions)(opts))
	http.ServeContent(b.Resp, b.Req, opts.Filename, opts.LastModified, r)

This reads like a panic bomb if opt / opts is nil that is not type checked by golang.

I would rather do one of

    1. also convert opts to a value here
    1. do a nil check

@wxiaoguang
Copy link
Copy Markdown
Contributor

wxiaoguang commented Mar 25, 2026

Are you sure we should do something like this:
This reads like a panic bomb if opt / opts is nil that is not type checked by golang.

That part of code has been there for long time, and the opts can't be nil, so far so good.

image

Changing them will cause more changes in this PR, since it is not necessary, we can leave them to the future.

Actually these func (b *Base) xxx functions and type-alias type ServeHeaderOptions httplib.ServeHeaderOptions should be removed in the future, they were just introduced to help refactoring messy code in history. Make repository response support HTTP range request (#24592)

@ChristopherHX
Copy link
Copy Markdown
Contributor Author

That part of code has been there for long time, and the opts can't be nil, so far so good.

Ok, yes everyone passes a non nil pointer, I think now this is mergeable as the last failing test is expected to pass now

@wxiaoguang wxiaoguang changed the title Feature non zipped actions artifacts (action v7 / nodejs/npm v6.2.0) Feature non-zipped actions artifacts (action v7 / nodejs/npm v6.2.0) Mar 25, 2026
@wxiaoguang wxiaoguang changed the title Feature non-zipped actions artifacts (action v7 / nodejs/npm v6.2.0) Feature non-zipped actions artifacts (action v7 / nodejs / npm v6.2.0) Mar 25, 2026
@wxiaoguang wxiaoguang merged commit bc5c554 into go-gitea:main Mar 25, 2026
26 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Mar 25, 2026
@wxiaoguang
Copy link
Copy Markdown
Contributor

Are you sure we should do something like this:
This reads like a panic bomb if opt / opts is nil that is not type checked by golang.

That part of code has been there for long time, and the opts can't be nil, so far so good.

Changing them will cause more changes in this PR, since it is not necessary, we can leave them to the future.

Actually these func (b *Base) xxx functions and type-alias type ServeHeaderOptions httplib.ServeHeaderOptions should be removed in the future, they were just introduced to help refactoring messy code in history. Make repository response support HTTP range request (#24592)

Done by AI : refactor: use value semantics for ServeHeaderOptions parameters #36982

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/gitea-actions related to the actions of Gitea type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gitea Actions is incompatible with actions/upload-artifact@v6 and later versions

7 participants