Skip to content

Commit e4786ec

Browse files
committed
replace abandoned action with git diff
1 parent 43f9c86 commit e4786ec

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

.github/workflows/lint_sqlfluff.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,24 @@ jobs:
99
steps:
1010
- name: checkout
1111
uses: actions/checkout@v4
12+
with:
13+
# Full history so we can diff the PR branch against its base
14+
fetch-depth: 0
1215
- name: Install Python
1316
uses: actions/setup-python@v5
1417
with:
1518
python-version: "3.12"
1619
- name: install sqlfluff
1720
run: "pip install sqlfluff==4.1.0"
18-
- name: Get changed files
19-
id: get_file_changes
20-
uses: trilom/file-changes-action@v1.2.4
21-
with:
22-
output: ' '
2321
- name: Get changed .sql files in mimic-iv concepts folder
2422
id: get_files_to_lint
2523
shell: bash
2624
run: |
27-
# Compose list of changed SQL files under mimic-iv/concepts and export to step output
28-
raw="${{ steps.get_file_changes.outputs.files_modified }} ${{ steps.get_file_changes.outputs.files_added }}"
29-
# Check for mimic-iv SQL files which may have changed
30-
filtered="$(printf '%s' "$raw" | tr -s ' ' '\n' | grep -E '^mimic-iv/concepts/.*[.]sql$' || true)"
31-
# Turn this into a space separated list for the next step
32-
files="$(printf '%s' "$filtered" | tr -s '\n' ' ')"
25+
# Added/modified (--diff-filter=AM) SQL files on the PR branch since
26+
# it diverged from the base branch, restricted to mimic-iv/concepts.
27+
files="$(git diff --name-only --diff-filter=AM \
28+
"origin/${{ github.base_ref }}...HEAD" -- 'mimic-iv/concepts/' \
29+
| grep -E '[.]sql$' | tr '\n' ' ' || true)"
3330
echo "lintees=${files}" >> "$GITHUB_OUTPUT"
3431
3532
- name: Lint SQL files

0 commit comments

Comments
 (0)