Created
July 28, 2023 11:24
-
-
Save maniankara/db341998b13b22e182e18d3a22bd7c8a to your computer and use it in GitHub Desktop.
Github action looping example. This is the only way to natively loop a step in GHA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: listfiles | |
on: | |
workflow_dispatch: | |
jobs: | |
list-png-files: | |
runs-on: ubuntu-latest | |
outputs: | |
file: ${{ steps.set-files.outputs.file }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: set-files | |
run: echo "::set-output name=file::$(ls *.png | jq -R -s -c 'split("\n")[:-1]')" | |
check: | |
needs: list-png-files | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
file: ${{ fromJson(needs.list-png-files.outputs.file) }} | |
steps: | |
- run: | | |
echo "${{ matrix.file }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment