Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename action #3

Merged
merged 3 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,101 +9,101 @@ 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
id: for-each-1
- name: Run colpal/actions-find-exec
id: _1
uses: ./
with:
patterns: 'fixtures/*'
- if: steps.for-each-1.outputs.matches != '["fixtures/function-a/","fixtures/function-b/","fixtures/function-c/","fixtures/run-a/","fixtures/run-b/"]'
- 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
id: for-each-2
- name: Run colpal/actions-find-exec
id: _2
uses: ./
with:
patterns: |
fixtures/*
!fixtures/*-b
- if: steps.for-each-2.outputs.matches != '["fixtures/function-a/","fixtures/function-c/","fixtures/run-a/"]'
- if: steps._2.outputs.matches != '["fixtures/function-a/","fixtures/function-c/","fixtures/run-a/"]'
run: exit 1

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

- name: Run colpal/actions-for-each
id: for-each-4
- name: Run colpal/actions-find-exec
id: _4
uses: ./
with:
root-patterns: '*/'
filter-patterns: '**/main.*'
- if: steps.for-each-4.outputs.matches != '["dist/"]'
- if: steps._4.outputs.matches != '["dist/"]'
run: exit 1

- name: Run colpal/actions-for-each
id: for-each-5
- name: Run colpal/actions-find-exec
id: _5
uses: ./
with:
root-patterns: |
./
**/
filter-patterns: '**/main.*'
- if: steps.for-each-5.outputs.matches != '["./","dist/"]'
- if: steps._5.outputs.matches != '["./","dist/"]'
run: exit 1

- name: Run colpal/actions-for-each
id: for-each-6
- name: Run colpal/actions-find-exec
id: _6
uses: ./
with:
root-patterns: |
**/*-b/
filter-patterns: '**/file.txt'
- if: steps.for-each-6.outputs.matches != '["fixtures/function-b/","fixtures/run-b/"]'
- if: steps._6.outputs.matches != '["fixtures/function-b/","fixtures/run-b/"]'
run: exit 1

- name: Run colpal/actions-for-each
id: for-each-7
- name: Run colpal/actions-find-exec
id: _7
uses: ./
with:
root-patterns: |
./
filter-patterns: |
**/flie.txt
- if: steps.for-each-7.outputs.matches != '[]'
- if: steps._7.outputs.matches != '[]'
run: exit 1

- name: Run colpal/actions-for-each
id: for-each-8
- name: Run colpal/actions-find-exec
id: _8
uses: ./
with:
patterns: |
banana/*
source: '["banana/a.txt","banana/b.txt","apple/a.txt"]'
- if: steps.for-each-8.outputs.matches != '["banana/a.txt","banana/b.txt"]'
- if: steps._8.outputs.matches != '["banana/a.txt","banana/b.txt"]'
run: exit 1

- name: Run colpal/actions-for-each
id: for-each-9
- name: Run colpal/actions-find-exec
id: _9
uses: ./
with:
patterns: |
**/a.txt
source: '["banana/a.txt","banana/b.txt","apple/a.txt"]'
- if: steps.for-each-9.outputs.matches != '["banana/a.txt","apple/a.txt"]'
- if: steps._9.outputs.matches != '["banana/a.txt","apple/a.txt"]'
run: exit 1

- name: Run colpal/actions-for-each
id: for-each-10
- name: Run colpal/actions-find-exec
id: _10
uses: ./
with:
root-patterns: |
Expand All @@ -112,11 +112,11 @@ jobs:
filter-patterns: |
**/b.txt
source: '["banana/a.txt","banana/b.txt","apple/a.txt"]'
- if: steps.for-each-10.outputs.matches != '["banana/"]'
- 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.