upload-artifact icon indicating copy to clipboard operation
upload-artifact copied to clipboard

[feat req] Multiple paths from input string

Open FalconerTC opened this issue 2 years ago • 1 comments

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 avatar Aug 10 '23 12:08 FalconerTC

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 }}

FalconerTC avatar Aug 10 '23 17:08 FalconerTC