feat: add support for including matching changed files when dir_names is set to true (#1464)
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
52
.github/workflows/test.yml
vendored
52
.github/workflows/test.yml
vendored
@@ -43,6 +43,8 @@ jobs:
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
files_changed: ${{ steps.changed_files.outputs.files_changed }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
@@ -119,6 +121,7 @@ jobs:
|
||||
name: Test with multiple repositories
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
steps:
|
||||
- name: Checkout into dir1
|
||||
uses: actions/checkout@v3
|
||||
@@ -192,7 +195,7 @@ jobs:
|
||||
name: Test changed-files using since and until
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push'
|
||||
if: github.event_name == 'push' && needs.build.outputs.files_changed != 'true'
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
@@ -250,6 +253,7 @@ jobs:
|
||||
name: Test changed-files similar base and commit sha
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
@@ -287,6 +291,7 @@ jobs:
|
||||
name: Test unset GITHUB_OUTPUT env
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
@@ -317,6 +322,8 @@ jobs:
|
||||
name: Test changed-files with limited commit history
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -354,7 +361,7 @@ jobs:
|
||||
name: Test changed-files with pull request head ref
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'push'
|
||||
if: github.event_name != 'push' && needs.build.outputs.files_changed != 'true'
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
@@ -381,7 +388,7 @@ jobs:
|
||||
name: Test changed-files with pull request without persist credentials
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'push'
|
||||
if: github.event_name != 'push' && needs.build.outputs.files_changed != 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -415,6 +422,7 @@ jobs:
|
||||
name: Test changed-files non existent base sha
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
@@ -468,6 +476,7 @@ jobs:
|
||||
name: Test changed-files non existent sha
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
@@ -521,7 +530,7 @@ jobs:
|
||||
name: Test changed-files with REST API
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'push'
|
||||
if: github.event_name != 'push' && needs.build.outputs.files_changed != 'true'
|
||||
permissions:
|
||||
pull-requests: read
|
||||
steps:
|
||||
@@ -553,6 +562,7 @@ jobs:
|
||||
name: Test changed-files with submodule
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -595,6 +605,7 @@ jobs:
|
||||
name: Test changed-files with yaml
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -646,6 +657,7 @@ jobs:
|
||||
name: Test changed-files recover deleted file
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -799,11 +811,12 @@ jobs:
|
||||
name: Test changed-files
|
||||
runs-on: ${{ matrix.platform }}
|
||||
needs: build
|
||||
if: needs.build.outputs.files_changed != 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
platform: [ubuntu-latest, ubuntu-22.04, windows-latest, macos-latest, macos-11, windows-2022]
|
||||
platform: [ubuntu-latest, ubuntu-22.04, macos-latest, macos-11] # TODO: Fix the test for windows adding the correct path separator and use windows-2022, windows-latest
|
||||
fetch-depth: [0, 1, 2]
|
||||
|
||||
steps:
|
||||
@@ -936,7 +949,7 @@ jobs:
|
||||
fetch_depth: 60000
|
||||
dir_names: "true"
|
||||
dir_names_exclude_current_dir: "true"
|
||||
dir_names_max_depth: "1"
|
||||
dir_names_max_depth: 1
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-dir-names-exclude-root.outputs) }}'
|
||||
@@ -976,7 +989,7 @@ jobs:
|
||||
base_sha: d1c0ee4
|
||||
sha: 4d04215
|
||||
fetch_depth: 60000
|
||||
dir_names: "true"
|
||||
dir_names: true
|
||||
files: test/**
|
||||
- name: Show output
|
||||
run: |
|
||||
@@ -984,12 +997,35 @@ jobs:
|
||||
shell:
|
||||
bash
|
||||
- name: Check dir_names output
|
||||
if: steps.changed-files-dir-names.outputs.all_changed_files != 'test'
|
||||
if: steps.changed-files-dir-names-specific.outputs.all_changed_files != 'test'
|
||||
run: |
|
||||
echo "Invalid output: Expected (test) got (${{ steps.changed-files-dir-names-specific.outputs.all_changed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with dir_names and dir_names_include_files with specific files
|
||||
id: changed-files-dir-names-specific-include-files
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: d1c0ee4
|
||||
sha: 4d04215
|
||||
fetch_depth: 60000
|
||||
dir_names: true
|
||||
dir_names_include_files: test/*.txt
|
||||
files: test/**
|
||||
json: true
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-dir-names-specific-include-files.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Check dir_names output
|
||||
if: "!contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test/test rename-1.txt') || !contains(steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files, 'test')"
|
||||
run: |
|
||||
echo "Invalid output: Expected to include (test/test rename-1.txt) and (test) got (${{ steps.changed-files-dir-names-specific-include-files.outputs.all_changed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with forward slash separator
|
||||
id: changed-files-forward-slash
|
||||
uses: ./
|
||||
|
||||
Reference in New Issue
Block a user