mirror of
https://github.com/tj-actions/changed-files
synced 2025-02-06 09:41:22 +00:00
Add support for multiple platforms (#102)
This commit is contained in:
parent
dc711ae840
commit
6254a409a7
3 changed files with 64 additions and 7 deletions
46
.github/workflows/test.yml
vendored
46
.github/workflows/test.yml
vendored
|
@ -10,9 +10,24 @@ on:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-no-head-sha:
|
shellcheck:
|
||||||
|
name: Run shellcheck
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout to branch
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: shellcheck
|
||||||
|
uses: reviewdog/action-shellcheck@v1.5
|
||||||
|
|
||||||
|
test-no-head-sha:
|
||||||
name: Test changed-files missing head sha
|
name: Test changed-files missing head sha
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout to branch
|
- name: Checkout to branch
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -25,32 +40,43 @@ jobs:
|
||||||
- name: Show output
|
- name: Show output
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Test changed-files
|
name: Test changed-files
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: shellcheck
|
|
||||||
uses: reviewdog/action-shellcheck@v1.5
|
|
||||||
- name: Run changed-files with defaults
|
- name: Run changed-files with defaults
|
||||||
id: changed-files
|
id: changed-files
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Show output
|
- name: Show output
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
- name: List all modified files
|
- name: List all modified files
|
||||||
run: |
|
run: |
|
||||||
for file in "${{ steps.changed-files.outputs.modified_files }}"; do
|
for file in "${{ steps.changed-files.outputs.modified_files }}"; do
|
||||||
echo $file
|
echo $file
|
||||||
done
|
done
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
- name: Run step when README.md changes
|
- name: Run step when README.md changes
|
||||||
if: contains(steps.changed-files.outputs.modified_files, 'README.md')
|
if: contains(steps.changed-files.outputs.modified_files, 'README.md')
|
||||||
run: |
|
run: |
|
||||||
echo "Your README.md has been modified ${{ steps.changed-files.outputs.modified_files }}."
|
echo "Your README.md has been modified ${{ steps.changed-files.outputs.modified_files }}."
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
- name: Run changed-files with comma separator
|
- name: Run changed-files with comma separator
|
||||||
id: changed-files-comma
|
id: changed-files-comma
|
||||||
uses: ./
|
uses: ./
|
||||||
|
@ -59,6 +85,8 @@ jobs:
|
||||||
- name: Show output
|
- name: Show output
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJSON(steps.changed-files-comma.outputs) }}"
|
echo "${{ toJSON(steps.changed-files-comma.outputs) }}"
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
- name: Run changed-files with specific files
|
- name: Run changed-files with specific files
|
||||||
id: changed-files-specific
|
id: changed-files-specific
|
||||||
uses: ./
|
uses: ./
|
||||||
|
@ -73,9 +101,13 @@ jobs:
|
||||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
- name: Show output
|
- name: Show output
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJSON(steps.changed-files-specific.outputs) }}"
|
echo "${{ toJSON(steps.changed-files-specific.outputs) }}"
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
- name: Run changed-files with specific files comma separator
|
- name: Run changed-files with specific files comma separator
|
||||||
id: changed-files-specific-comma
|
id: changed-files-specific-comma
|
||||||
uses: ./
|
uses: ./
|
||||||
|
@ -91,6 +123,10 @@ jobs:
|
||||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
- name: Show output
|
- name: Show output
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJSON(steps.changed-files-specific-comma.outputs) }}"
|
echo "${{ toJSON(steps.changed-files-specific-comma.outputs) }}"
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
|
|
25
action.yml
25
action.yml
|
@ -18,30 +18,51 @@ inputs:
|
||||||
outputs:
|
outputs:
|
||||||
added_files:
|
added_files:
|
||||||
description: List of added files.
|
description: List of added files.
|
||||||
|
value: ${{ steps.changed-files.outputs.added_files }}
|
||||||
copied_files:
|
copied_files:
|
||||||
description: List of copied files.
|
description: List of copied files.
|
||||||
|
value: ${{ steps.changed-files.outputs.copied_files }}
|
||||||
deleted_files:
|
deleted_files:
|
||||||
description: List of deleted files.
|
description: List of deleted files.
|
||||||
|
value: ${{ steps.changed-files.outputs.deleted_files }}
|
||||||
modified_files:
|
modified_files:
|
||||||
description: List of modified files.
|
description: List of modified files.
|
||||||
|
value: ${{ steps.changed-files.outputs.modified_files }}
|
||||||
renamed_files:
|
renamed_files:
|
||||||
description: List of renamed files.
|
description: List of renamed files.
|
||||||
|
value: ${{ steps.changed-files.outputs.renamed_files }}
|
||||||
changed_files:
|
changed_files:
|
||||||
description: List of changed files.
|
description: List of changed files.
|
||||||
|
value: ${{ steps.changed-files.outputs.changed_files }}
|
||||||
unmerged_files:
|
unmerged_files:
|
||||||
description: List of unmerged files.
|
description: List of unmerged files.
|
||||||
|
value: ${{ steps.changed-files.outputs.unmerged_files }}
|
||||||
unknown_files:
|
unknown_files:
|
||||||
description: List of unknown files.
|
description: List of unknown files.
|
||||||
|
value: ${{ steps.changed-files.outputs.unknown_files }}
|
||||||
all_changed_files:
|
all_changed_files:
|
||||||
description: List of all changed files.
|
description: List of all changed files.
|
||||||
|
value: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||||
all_modified_files:
|
all_modified_files:
|
||||||
description: List of all copied modified and added files.
|
description: List of all copied modified and added files.
|
||||||
|
value: ${{ steps.changed-files.outputs.all_modified_files }}
|
||||||
any_changed:
|
any_changed:
|
||||||
description: Return true only when any files provided using the files input have changed.
|
description: Return true only when any files provided using the files input have changed.
|
||||||
|
value: ${{ steps.changed-files.outputs.any_changed }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'composite'
|
||||||
image: 'Dockerfile'
|
steps:
|
||||||
|
- run: |
|
||||||
|
bash $GITHUB_ACTION_PATH/entrypoint.sh
|
||||||
|
id: changed-files
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
|
||||||
|
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
|
||||||
|
INPUT_TOKEN: ${{ inputs.github_token }}
|
||||||
|
INPUT_FILES: ${{ inputs.files }}
|
||||||
|
INPUT_SEPARATOR: ${{ inputs.separator }}
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: file-text
|
icon: file-text
|
||||||
|
|
0
entrypoint.sh
Normal file → Executable file
0
entrypoint.sh
Normal file → Executable file
Loading…
Add table
Reference in a new issue