https://github.com/philips-labs/list-folder-action
Get a list of folders in a directory and return them as a json list
https://github.com/philips-labs/list-folder-action
Last synced: 7 months ago
JSON representation
Get a list of folders in a directory and return them as a json list
- Host: GitHub
- URL: https://github.com/philips-labs/list-folder-action
- Owner: philips-labs
- License: mit
- Created: 2021-10-11T11:55:17.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-23T23:18:23.000Z (almost 2 years ago)
- Last Synced: 2025-01-18T05:30:46.762Z (9 months ago)
- Size: 4.88 KB
- Stars: 8
- Watchers: 2
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# List Folder Action
This action lists the folders in the given directory and returns them as a json formatted list.
This is useful for using in subsequent jobs as the matrix command so you can run a job per sub folder.
This is currently a simple composite action. It ensures that all tools needed are installed by running `apt install` commands. Therefore it is advised to run this inside a debian/ubuntu based runner or container.
## Inputs
| Name | Description | Required |
| ---- | ----------------------------------------------- | -------- |
| path | The path of a folder to list the sub folders of | true |## Outputs
| Name | Description |
| ------- | --------------------------------------------- |
| folders | The json formatted string list of sub folders |## Example
This action can be used to list the folders and input them into a matrix for a subsequent job.
```yaml
jobs:
find-jobs:
name: Find Jobs
container: debian:buster-slim
outputs:
folders: ${{ steps.jobs.outputs.folders }}
steps:
- uses: actions/checkout@v1- id: jobs
uses: philips-labs/list-folders-action@v1
with:
path: ./path/to/foldermatrix:
name: Matrix Jobs
needs: [find-jobs]
container: ubuntu
defaults:
run:
working-directory: ${{ matrix.folder }}
strategy:
matrix:
folder: ${{ fromJson(needs.find-jobs.outputs.folders )}}
steps:
- name: do something
run: echo ${{ matrix.folder }}
```