actions / upload-artifact

MIT License
3.03k stars 686 forks source link

[feat req] Multiple paths from input string #424

Open FalconerTC opened 11 months ago

FalconerTC commented 11 months ago

What would you like to be added?

Multiple paths can be given to upload-artifact but only as a multi-line string. There doesn't seem to be any clean way of passing a multi-line string as an input variable (via workflow_call for example)

Why is this needed?

This would enable upload-artifact to be more flexible when used inside reusable workflows

FalconerTC commented 11 months ago

For the curious, here's how I ended up doing this


name: Test workflow

on:
  workflow_call:
    inputs:
      directoriesToUpload:
        required: true
        type: string

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Set artifact paths
        shell: bash
        run: |
          echo "Formatting artifact upload paths"
          {
            echo 'ARTIFACT_PATHS<<EOF'
            echo "${{ inputs.directoriesToUpload }}" | sed 's/,/\n/g'
            echo EOF
          } >> "$GITHUB_ENV"
      - name: Upload artifacts
        uses: actions/upload-artifact@v3
        with:
          name: artifacts
          path: |-
            ${{ env.ARTIFACT_PATHS }}