Multi-element output from step in Github Actions

I want to create a step in the job which will output multiple file names which then could be iterated in another step. Here is my test workflow:

name: test-workflow

on:
  push:
    branches: [ master ]

jobs:
  test-job:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout this repo
        uses: actions/checkout@v2
        with:
          fetch-depth: 2

      - name: Test1
        id: test1
        run: |
          for f in $(ls $GITHUB_WORKSPACE/.github/workflows); do
            echo "file: $f"
            echo "::set-output name=f::$f"
          done

      - name: Test2
        run: |
          for file in "${{ steps.test1.outputs.f }}"; do
            echo "$file detected"
          done

However, Test2 prints out only last file name listed in the Test1 by ls.
How can I set output f from Test1 to multiple values?

Personally, I ended up using a directory instead.

But, you have choices…

You could instead output a single file whose contents are a list of filenames (this is the easiest, you can choose either \0 or \n delimited depending on your preference).

Or you could construct some object (json array, whatever) and then spit out the encoded set.

w/ the directory, you can do something like:

- name: Test2
   run: |
     for file in ${{ steps.test1.outputs.directory}}/*; do
       echo "$(basename $file) detected"
     done

If the files need to live in strange places, you can use symlinks to them instead of actually dumping them into a single directory…