Skip to content

Conversation

@shiipou
Copy link

@shiipou shiipou commented Jun 19, 2025

This PR just add the possibility to filter what we want to unzip or not when downloading artifacts.

This feature was asked by so many people. I choose to focus on simplicity on this implementation and change almost nothing in the code, so it won't break any part of the existing toolkit.

Here a simple example that show how it work : https://github.com/shiipou/download-artifact/blob/main/.github/workflows/test.yml

You can also try it with this workflow :

Workflow
name: Loop Over Artifact IDs

on: [push]

permissions:
  contents: write
  actions: write
  packages: write

jobs:
  create-artifacts:
    runs-on: ubuntu-latest
    steps:
      - name: Create and upload artifacts
        run: |
          mkdir -p artifact1 artifact2
          echo "Content1" > artifact1/file.txt
          echo "Content2.1" > artifact2/file1.txt
          echo "Content2.2" > artifact2/file2.txt
          echo "Content2.3" > artifact2/file3.txt
      - id: artifact-1
        name: Upload artifact 1
        uses: actions/upload-artifact@v4
        with:
          name: artifact1
          path: artifact1/*
      - id: artifact-2
        name: Upload artifact 2
        uses: actions/upload-artifact@v4
        with:
          name: artifact2
          path: artifact2/*
    outputs:
      artifact-1-id: ${{ steps.artifact-1.outputs.artifact-id }}
      artifact-2-id: ${{ steps.artifact-2.outputs.artifact-id }}

  process-artifacts:
    needs: create-artifacts
    runs-on: ubuntu-latest
    steps:
      - id: download-artifacts
        name: Download artifacts
        uses: shiipou/download-artifact@main
        with:
          artifact-ids: ${{ needs.create-artifacts.outputs.artifact-1-id }},${{ needs.create-artifacts.outputs.artifact-2-id }}
          path: artifacts/
          unzip: ${{ needs.create-artifacts.outputs.artifact-1-id }}
      - name: print artifacts
        run: ls -pAR artifacts/
      - name: unzip artifacts
        run: unzip artifacts/**/*.zip

image

Copilot AI review requested due to automatic review settings December 3, 2025 13:28
@shiipou
Copy link
Author

shiipou commented Dec 3, 2025

I've rebased the PR on the latest commit of main.

Copilot finished reviewing on behalf of shiipou December 3, 2025 13:32
Copy link
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

This PR adds support for an unzip argument in the downloadArtifact functionality, allowing users to download artifacts as zip files without automatic extraction. This addresses a frequently requested feature while maintaining backward compatibility (defaults to unzip: true).

Key changes:

  • Added unzip and artifactName options to control whether artifacts are automatically extracted
  • Created StreamExtractOptions interface to encapsulate streaming/extraction parameters
  • Updated both public and internal download functions to support the new options

Reviewed changes

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

File Description
packages/artifact/src/internal/shared/interfaces.ts Added unzip and artifactName properties to DownloadArtifactOptions and created new StreamExtractOptions interface
packages/artifact/src/internal/download/download-artifact.ts Modified stream extraction logic to conditionally unzip or save as .zip file based on options; updated function signatures to accept new options
packages/artifact/__tests__/download-artifact.test.ts Added test cases for keeping artifacts zipped in both public and internal download scenarios
Comments suppressed due to low confidence (1)

packages/artifact/src/internal/download/download-artifact.ts:27

  • Unused imports basename, join.
import { basename, join } from 'path'

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants