Skip to content

fix: handle non-zipped artifact downloads - #13013

Open
dsanders11 wants to merge 2 commits into
cli:trunkfrom
dsanders11:fix-non-zipped-artifact-download
Open

dsanders11 wants to merge 2 commits into
cli:trunkfrom
dsanders11:fix-non-zipped-artifact-download

Conversation

@dsanders11

Copy link
Copy Markdown

Fixes #13012.

@dsanders11
dsanders11 requested a review from a team as a code owner March 24, 2026 04:06
@github-actions github-actions Bot added unmet-requirements external pull request originating outside of the CLI core team needs-triage needs to be reviewed labels Mar 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your pull request! Unfortunately, it doesn't meet the minimum requirements for review:

  • None of the referenced issues have the help wanted label

Please update your PR to address the above. Requirements:

  1. Include a detailed description of what this PR does
  2. Link to an issue with the help wanted label (use Fixes #123 or Closes #123 if it resolves the issue)

This PR will be automatically closed in 7 days if these requirements are not met.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates gh run download to support downloading GitHub Actions artifacts that are not delivered as zip archives (e.g., uploaded with archive: false), avoiding the current unconditional unzip behavior that fails on non-zip payloads.

Changes:

  • Extend the download platform interface to pass artifact name into the download implementation.
  • Add a non-zip download path in the HTTP downloader based on the response Content-Type.
  • Add test coverage and a fixture for non-zipped artifact downloads.

Reviewed changes

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

Show a summary per file
File Description
pkg/cmd/run/download/http.go Adds non-zip handling and updates downloader signature to accept artifact name
pkg/cmd/run/download/http_test.go Updates zip test to set Content-Type and adds a non-zip download test
pkg/cmd/run/download/fixtures/mytest.json Adds a fixture representing non-zipped artifact content
pkg/cmd/run/download/download.go Updates platform interface usage to pass artifact name to Download
pkg/cmd/run/download/download_test.go Updates fake platform to match the new Download signature

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

Comment thread pkg/cmd/run/download/http.go Resolved
Comment on lines +48 to +49
if resp.Header.Get("Content-Type") != "application/zip" {
destPath, err := destDir.Join(name)

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

The zip-vs-nonzip decision is based on a strict Content-Type == "application/zip" check. In practice servers often include parameters (e.g. application/zip; charset=binary), omit the header, or use application/octet-stream for zip content, which would route zip downloads into the raw-file path. Parse the media type (e.g. via mime.ParseMediaType) and/or fall back to detecting/attempting zip extraction (and on zip: not a valid zip file, retry as a raw download).

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Considering these are GitHub controlled servers, I think it's reasonable to just use the Content-Type header to make the distinction.

Comment thread pkg/cmd/run/download/http_test.go Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for updating your pull request! It now meets the minimum requirements and has been queued for triage.

@williammartin

Copy link
Copy Markdown
Member

Whoops sorry for letting this sit, will try to get to it today!

@dmorgan-fa

Copy link
Copy Markdown

@williammartin, is there any chance this can be reviewed and shipped please?

ke66344060-ship-it

This comment was marked as low quality.

ke66344060-ship-it

This comment was marked as low quality.

@iTrooz

iTrooz commented Jul 21, 2026 •

Copy link
Copy Markdown

Would it be possible to also add a flag to not unzip the file instead of only relying on the Content-Type header ? To also fix #12435 at the same time

kjelly added a commit to kjelly/pilot that referenced this pull request Oct 31, 2026
mark_ready.py moved a Draft to Ready without looking at review threads or
the review decision. A PR with an unresolved thread is then returned to
Draft by pr-review-merge, and a CHANGES_REQUESTED review was simply
ignored, although Ready is meant to say nothing is left to do.

- mark_ready reads every page of the PR's review threads (GraphQL, query
  and answers captured from gh 2.103.3: #201 with none,
  cli/cli#13013 with one unresolved of three) and refuses Ready while
  any is unresolved; a lookup that fails or is malformed blocks.
- reviewDecision CHANGES_REQUESTED blocks and points at pr-ready, which
  owns review feedback on a Draft (fix, or dispute with a reply);
  mark_ready does not triage it. "" (no review required),
  REVIEW_REQUIRED and APPROVED do not block.

Two P4s from the #201 review, both already fail-closed:
- a mistyped issue_resolution such as "Partial" is now reported as such
  by create_pr.py, instead of as a missing "Fixes #N";
- a follow_up_issue_url number longer than 10 digits is a format error;
  over 4300 digits int() raised and the gate CLI died with a traceback.

10 mutants of the new checks all fail the tests; an unmutated copy passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

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

Labels

external pull request originating outside of the CLI core team ready-for-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't Download Non-Zipped Artifacts

7 participants