Skip to content

Commit

Permalink
Rename action to Find Exec
Browse files Browse the repository at this point in the history
  • Loading branch information
nafarlee committed Dec 7, 2023
1 parent 999bd4c commit b726fc5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ jobs:
main:
runs-on: ubuntu-latest
outputs:
matches: ${{ steps.for-each.outputs.matches }}
matches: ${{ steps.find-exec.outputs.matches }}
steps:
- uses: actions/checkout@v4

- name: Run colpal/actions-for-each
- name: Run colpal/actions-find-exec
id: '1'
uses: ./
with:
patterns: 'fixtures/*'
- if: steps.1.outputs.matches != '["fixtures/function-a/","fixtures/function-b/","fixtures/function-c/","fixtures/run-a/","fixtures/run-b/"]'
run: exit 1

- name: Run colpal/actions-for-each
- name: Run colpal/actions-find-exec
id: '2'
uses: ./
with:
Expand All @@ -31,7 +31,7 @@ jobs:
- if: steps.2.outputs.matches != '["fixtures/function-a/","fixtures/function-c/","fixtures/run-a/"]'
run: exit 1

- name: Run colpal/actions-for-each
- name: Run colpal/actions-find-exec
id: '3'
uses: ./
with:
Expand All @@ -41,7 +41,7 @@ jobs:
- if: steps.3.outputs.matches != '["fixtures/run-a/file.txt","fixtures/run-b/file.txt"]'
run: exit 1

- name: Run colpal/actions-for-each
- name: Run colpal/actions-find-exec
id: '4'
uses: ./
with:
Expand All @@ -50,7 +50,7 @@ jobs:
- if: steps.4.outputs.matches != '["dist/"]'
run: exit 1

- name: Run colpal/actions-for-each
- name: Run colpal/actions-find-exec
id: '5'
uses: ./
with:
Expand All @@ -61,7 +61,7 @@ jobs:
- if: steps.5.outputs.matches != '["./","dist/"]'
run: exit 1

- name: Run colpal/actions-for-each
- name: Run colpal/actions-find-exec
id: '6'
uses: ./
with:
Expand All @@ -71,7 +71,7 @@ jobs:
- if: steps.6.outputs.matches != '["fixtures/function-b/","fixtures/run-b/"]'
run: exit 1

- name: Run colpal/actions-for-each
- name: Run colpal/actions-find-exec
id: '7'
uses: ./
with:
Expand All @@ -82,7 +82,7 @@ jobs:
- if: steps.7.outputs.matches != '[]'
run: exit 1

- name: Run colpal/actions-for-each
- name: Run colpal/actions-find-exec
id: '8'
uses: ./
with:
Expand All @@ -92,7 +92,7 @@ jobs:
- if: steps.8.outputs.matches != '["banana/a.txt","banana/b.txt"]'
run: exit 1

- name: Run colpal/actions-for-each
- name: Run colpal/actions-find-exec
id: '9'
uses: ./
with:
Expand All @@ -102,7 +102,7 @@ jobs:
- if: steps.9.outputs.matches != '["banana/a.txt","apple/a.txt"]'
run: exit 1

- name: Run colpal/actions-for-each
- name: Run colpal/actions-find-exec
id: '10'
uses: ./
with:
Expand All @@ -115,8 +115,8 @@ jobs:
- if: steps.10.outputs.matches != '["banana/"]'
run: exit 1

- name: Run colpal/actions-for-each
id: for-each
- name: Run colpal/actions-find-exec
id: find-exec
uses: ./
with:
patterns: 'fixtures/run-*'
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# For Each
# Find Exec

Glob the filesystem to create `matrix` definitions for parallel jobs. This
action uses [globby](https://github.com/sindresorhus/globby) under the hood
Expand All @@ -18,13 +18,13 @@ steps:
# │   └── file.txt
# └── other-folder
#    └── file.txt
- id: for-each
uses: colpal/actions-for-each@v0.1
- id: find-exec
uses: colpal/actions-find-exec@v0.1
with:
patterns: |
**/file.txt
!other-folder/*
- run: echo ${{ steps.for-each.outputs.matches }}
- run: echo ${{ steps.find-exec.outputs.matches }}
# ["function-a/file.txt","function-b/file.txt"]
```

Expand All @@ -46,13 +46,13 @@ jobs:
# └── other-folder
#    ├── main.js
#    └── deploy.sh
- id: for-each
uses: colpal/actions-for-each@v0.1
- id: find-exec
uses: colpal/actions-find-exec@v0.1
with:
patterns: 'function-*'
outputs:
# ["function-a/", "function-b/"]
matches: ${{ steps.for-each.outputs.matches }}
matches: ${{ steps.find-exec.outputs.matches }}

conquer:
needs: divide
Expand All @@ -72,8 +72,8 @@ For more details on the supported patterns, see
```yaml
steps:
- id: for-each
uses: colpal/actions-for-each@v0.1
- id: find-exec
uses: colpal/actions-find-exec@v0.1
with:
# REQUIRED (if `root-patterns` is not specified)
# The pattern(s) to be used to find folders/files. More than one pattern
Expand Down Expand Up @@ -113,15 +113,15 @@ steps:
root-patterns: single-line string | multi-line string
outputs:
# An JSON-formatted array of paths that matched the pattern(s)
matches: ${{ steps.for-each.outputs.matches }}
matches: ${{ steps.find-exec.outputs.matches }}
```
## Recipes
### Find all folders that contain certain files
```yaml
- uses: colpal/actions-for-each@v0.1
- uses: colpal/actions-find-exec@v0.1
with:
root-patterns: |
./
Expand Down Expand Up @@ -151,15 +151,15 @@ jobs:
divide:
steps:
- uses: actions/checkout@v4
- id: for-each
uses: colpal/actions-for-each@v0.1
- id: find-exec
uses: colpal/actions-find-exec@v0.1
with:
root-patterns: |
containers/*/
filter-patterns: |
containers/*/**
outputs:
matches: ${{ steps.for-each.outputs.matches }}
matches: ${{ steps.find-exec.outputs.matches }}

conquer:
needs: divide
Expand Down Expand Up @@ -198,16 +198,16 @@ jobs:
fetch-depth: 0
- id: changed
uses: colpal/actions-changed-files@v3
- id: for-each
uses: colpal/actions-for-each@v0.1
- id: find-exec
uses: colpal/actions-find-exec@v0.1
with:
root-patterns: |
containers/*/
filter-patterns: |
containers/*/**
source: ${{ toJSON(fromJSON(steps.changed.outputs.json).all) }}
outputs:
matches: ${{ steps.for-each.outputs.matches }}
matches: ${{ steps.find-exec.outputs.matches }}

conquer:
needs: divide
Expand Down
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: For Each
name: Find Exec
description: Create "matrix" compliant file/folder lists using patterns
inputs:
patterns:
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b726fc5

Please sign in to comment.