Skip to content

Reduce cost by collapsing workflow jobs #10

Reduce cost by collapsing workflow jobs

Reduce cost by collapsing workflow jobs #10

Workflow file for this run

on: push
jobs:
main:
runs-on: ubuntu-latest
outputs:
paths: ${{ steps.for-each-4.outputs.paths }}
steps:
- uses: actions/checkout@v3
- name: Run colpal/actions-for-each
id: for-each-1
uses: ./
with:
patterns: 'fixtures/*'
- if: steps.for-each-1.outputs.paths != '["fixtures/function-a/","fixtures/function-b/","fixtures/function-c/","fixtures/run-a/","fixtures/run-b/"]'
run: exit 1
- name: Run colpal/actions-for-each
id: for-each-2
uses: ./
with:
patterns: |
fixtures/*
!fixtures/*-b
- if: steps.for-each-2.outputs.paths != '["fixtures/function-a/","fixtures/function-c/","fixtures/run-a/"]'
run: exit 1
- name: Run colpal/actions-for-each
id: for-each-3
uses: ./
with:
patterns: |
fixtures/**/file.txt
!fixtures/function-*/**
- if: steps.for-each-3.outputs.paths != '["fixtures/run-a/file.txt","fixtures/run-b/file.txt"]'
run: exit 1
- name: Run colpal/actions-for-each
id: for-each-4
uses: ./
with:
patterns: 'fixtures/run-*'
parallel:
needs: main
runs-on: ubuntu-latest
strategy:
matrix:
path: ${{ fromJSON(needs.main.outputs.paths) }}
steps:
- uses: actions/checkout@v3
- run: cat ${{ matrix.path }}file.txt