3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-17 23:44:46 +00:00
changed-files/.github/workflows/test.yml

46 lines
1.2 KiB
YAML
Raw Normal View History

2021-03-05 02:36:52 +00:00
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
name: Test changed-files
steps:
- name: Checkout
uses: actions/checkout@v2
2021-03-05 12:28:53 +00:00
- name: Run changed-files with defaults
2021-04-02 12:44:13 +00:00
if: github.event_name == 'pull_request'
2021-03-05 03:36:52 +00:00
id: changed-files
2021-03-05 02:36:52 +00:00
uses: ./
2021-03-05 03:36:52 +00:00
- name: Show output
2021-04-02 12:13:34 +00:00
if: github.event_name == 'pull_request'
2021-03-05 03:36:52 +00:00
run: |
2021-03-05 11:17:27 +00:00
echo "${{ toJSON(steps.changed-files.outputs) }}"
2021-03-25 23:23:19 +00:00
- name: List all modified files
2021-04-02 12:13:34 +00:00
if: github.event_name == 'pull_request'
2021-03-20 12:09:58 +00:00
run: |
2021-03-25 23:23:19 +00:00
for file in "${{ steps.changed-files.outputs.modified_files }}"; do
2021-03-20 12:09:58 +00:00
echo $file
done
2021-04-02 12:27:48 +00:00
- name: Run step when README.md changes
2021-04-02 12:46:17 +00:00
if: contains(${{ steps.changed-files.outputs.modified_files }}, "README.md")
2021-04-02 12:27:48 +00:00
run: |
echo "Your README.md has been modified."
2021-03-05 12:28:53 +00:00
- name: Run changed-files with comma separator
2021-04-02 12:13:34 +00:00
if: github.event_name == 'pull_request'
2021-03-05 12:28:53 +00:00
id: changed-files-comma
uses: ./
with:
separator: ","
- name: Show output
2021-04-02 12:13:34 +00:00
if: github.event_name == 'pull_request'
2021-03-05 12:28:53 +00:00
run: |
echo "${{ toJSON(steps.changed-files-comma.outputs) }}"