-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aaae5be
commit 26338d3
Showing
2 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters