-
name: CI
on:
pull_request:
branches:
- main
jobs:
changed_files:
runs-on: ubuntu-latest
name: Test changed-files
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: Get changed files in the mysql folder
id: changed-files-specific
uses: tj-actions/changed-files@v39
with:
files: mysql/*.{sql} # Alternatively using: `docs/**` or `docs`
- name: List all changed specific files
run: |
for file in ${{ steps.changed-files-specific.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: Run step if any file(s) in the mysql folder change
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
echo "One or more files in the docs folder has changed."
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
-- I'm trying the test the above action to verify if there are any .sql files got changed under mysql folder. This is for every PR. It is listing the files for id: changed-files not for id: changed-files-specific. Sample output : Run for file in ; do |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
HI @relkarthi, I'll suggest just using the E.g - name: Get changed files in the mysql folder
id: changed-files-specific
uses: tj-actions/changed-files@v39
with:
files: mysql/**.sql
|
Beta Was this translation helpful? Give feedback.
HI @relkarthi, I'll suggest just using the
.sql
extension without braces since you aren't filtering multiple extensions.E.g
mysql/**.sql
: This would include all files and subfolders under themysql
foldermysql/*.sql
: This would only include files in themysql
folder