Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
sankichi92 committed Jul 1, 2024
1 parent aaae5be commit 26338d3
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
# list-changed-directories

Custom GitHub action that outputs a list of changed directories that include a target file.
A custom GitHub action that outputs a list of changed directories including a target file.

This action can be used only on `push` and `pull_request` events.

## Inputs

### `target-file`

**Required**. A filename that must be included in the output directories.

## Outputs

### `changed-directories`

The list of changed directories as a JSON string.

## Example Workflow

This workflow runs `bundle exec rake` in every directory that has changed and includes `Gemfile`:

```yaml
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
list-target-dirs:
runs-on: ubuntu-latest

outputs:
dirs: ${{ steps.list-changed-directories.outputs.changed-directories }}

steps:
- uses: actions/checkout@v4

- uses: sankichi92/list-changed-directories@v1
id: list-changed-directories
with:
target-file: Gemfile

test:
needs: list-target-dirs
if: needs.list-target-dirs.outputs.dirs != '[]'

runs-on: ubuntu-latest

strategy:
matrix:
dir: ${{ fromJSON(needs.list-target-dirs.outputs.dirs) }}

defaults:
run:
working-directory: ${{ matrix.dir }}

steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- run: bundle exec rake
```
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Outputs a list of changed directories that include a target file

inputs:
target-file:
description: File name that the output directories must include
description: Filename that the output directories must include
required: true

outputs:
Expand Down

0 comments on commit 26338d3

Please sign in to comment.