Skip to content

Commit

Permalink
Merge a2dff3f into 5b6b4e6
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamasato authored Jan 5, 2024
2 parents 5b6b4e6 + a2dff3f commit 1e94d73
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .github/workflows/changed-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ on:
pull_request:

jobs:
change-on-branch:
changes-in-ga-steps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.

- name: add test.txt file
id: add-file
run: |
Expand All @@ -28,10 +29,45 @@ jobs:
files_yaml: |
test:
- 'test-*'
- name: output change
run: |
{
echo "any_changed: ${{ steps.changed-files-yaml.outputs.test_any_changed }}";
echo "all_changed_files: ${{ steps.changed-files-yaml.outputs.test_all_changed_files }}";
echo "add-file: ${{ steps.add-file.outputs.changed }}";
} >> "$GITHUB_STEP_SUMMARY"
get-changed-dirs:
runs-on: [ubuntu-latest]
outputs:
changed_dirs: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.

- name: get all changes
id: changed-files
uses: tj-actions/changed-files@v41
with:
dir_names: true
dir_names_max_depth: 2 # e.g. check-change/app
json: true
files: 'check-change/**'

- name: check output
run: |
echo "changed_dirs: ${{ steps.changed-files.outputs.all_changed_files }}"
do-sth-on-changed-dirs:
runs-on: ubuntu-latest
if: ${{ needs.get-changed-dirs.outputs.changed_dirs != '[]' }} # Without it, the strategy parser will fail if the changed_directories is empty.
strategy:
matrix:
dir: ${{ fromJson(needs.get-changed-dirs.outputs.changed_dirs) }}
needs:
- get-changed-dirs
steps:
- uses: actions/checkout@v3
- run: echo "do sth on changed dir ${{ matrix.dir }}"
1 change: 1 addition & 0 deletions check-change/test.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test,test

0 comments on commit 1e94d73

Please sign in to comment.