https://github.com/remarkablemark/find-and-split
✂️ GitHub Action that finds and splits files.
https://github.com/remarkablemark/find-and-split
actions composite files find github github-actions shard split
Last synced: about 2 months ago
JSON representation
✂️ GitHub Action that finds and splits files.
- Host: GitHub
- URL: https://github.com/remarkablemark/find-and-split
- Owner: remarkablemark
- License: mit
- Created: 2025-02-12T03:28:45.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-02-28T05:53:48.000Z (3 months ago)
- Last Synced: 2025-04-02T23:16:57.006Z (2 months ago)
- Topics: actions, composite, files, find, github, github-actions, shard, split
- Homepage: https://github.com/marketplace/actions/find-and-split
- Size: 61.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# find-and-split
[](https://github.com/remarkablemark/find-and-split/releases)
[](https://github.com/remarkablemark/find-and-split/actions/workflows/test.yml)
[](https://opensource.org/licenses/MIT)✂️ GitHub Action that finds and splits files.
## Quick Start
Find and split files using the [matrix strategy](https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow):
```yaml
on: push
jobs:
find-and-split:
runs-on: ubuntu-latest
strategy:
matrix:
chunk: [1/2, 2/2]steps:
- name: Checkout repository
uses: actions/checkout@v4- name: Find and split files
uses: remarkablemark/find-and-split@v1
id: my-files
with:
pattern: '*.txt'
chunk: ${{ matrix.chunk }}- name: Print files
run: echo ${{ steps.my-files.outputs.files }}
```## Usage
Find half of the files matching `*.txt` in alphabetical order:
```yaml
- uses: remarkablemark/find-and-split@v1
with:
pattern: '*.txt'
chunk: 1/2
```See [action.yml](action.yml)
## Inputs
### `chunk`
**Required**: The chunk as a fraction (e.g., 1/2). The numerator is the chunk index and the denominator is the chunk total.
```yaml
- uses: remarkablemark/find-and-split@v1
with:
chunk: 1/2
```> [!NOTE]
> The chunk limit is 256 because that's the maximum jobs per workflow run.### `pattern`
**Required**: The filename pattern.
```yaml
- uses: remarkablemark/find-and-split@v1
with:
pattern: '*.txt'
```> Special shell pattern matching characters (`[`, `]`, `*`, and `?`) may be used as part of the pattern.
> These characters may be matched explicitly by escaping them with a backslash (`\`).### `directory`
**Optional**: The directory. Defaults to the current working directory.
```yaml
- uses: remarkablemark/find-and-split@v1
with:
directory: .
```### `delimiter`
**Optional**: The delimiter. Defaults to a space.
```yaml
- uses: remarkablemark/find-and-split@v1
with:
delimiter: ' '
```Set the delimiter to `\n` for multiline files:
```yaml
- uses: remarkablemark/find-and-split@v1
with:
delimiter: '\n'
```## Outputs
### `files`
The list of files. For example:
```
./test/1.spec ./test/2.spec
```With `delimiter: '\n'`, the output will be:
```
./test/1.spec
./test/2.spec
```## Examples
- [cypress-cucumber-steps](https://github.com/remarkablemark/cypress-cucumber-steps/blob/master/.github/workflows/cypress.yml)
- [phpunit-test-sharding](https://github.com/remarkablemark/phpunit-test-sharding)## License
[MIT](LICENSE)