|
8 | 8 | runs-on: ubuntu-latest |
9 | 9 | steps: |
10 | 10 | - name: checkout |
11 | | - uses: actions/checkout@v3 |
| 11 | + uses: actions/checkout@v4 |
12 | 12 | - name: Install Python |
13 | | - uses: "actions/setup-python@v2" |
| 13 | + uses: actions/setup-python@v5 |
14 | 14 | with: |
15 | | - python-version: "3.7" |
| 15 | + python-version: "3.12" |
16 | 16 | - name: install sqlfluff |
17 | | - run: "pip install sqlfluff==1.4.5" |
| 17 | + run: "pip install sqlfluff==3.5.0" |
18 | 18 | - name: Get changed files |
19 | 19 | id: get_file_changes |
20 | 20 | uses: trilom/file-changes-action@v1.2.4 |
21 | 21 | with: |
22 | 22 | output: ' ' |
23 | 23 | - name: Get changed .sql files in mimic-iv concepts folder |
24 | 24 | id: get_files_to_lint |
25 | | - shell: bash -l {0} |
| 25 | + shell: bash |
26 | 26 | run: | |
27 | | - # Set the command in the $() brackets as an output to use in later steps |
28 | | - echo "lintees=$( |
29 | | - echo \ |
30 | | - $(echo ${{ steps.get_file_changes.outputs.files_modified }} | |
31 | | - tr -s ' ' '\n' | |
32 | | - grep -E '^mimic-iv/concepts/.*[.]sql$' | |
33 | | - tr -s '\n' ' ') \ |
34 | | - $(echo ${{ steps.get_file_changes.outputs.files_added }} | |
35 | | - tr -s ' ' '\n' | |
36 | | - grep -E '^mimic-iv/concepts/.*[.]sql$' | |
37 | | - tr -s '\n' ' ') |
38 | | - ) >> $GITHUB_OUTPUT" |
| 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' ' ')" |
| 33 | + echo "lintees=${files}" >> "$GITHUB_OUTPUT" |
39 | 34 |
|
40 | 35 | - name: Lint SQL files |
41 | 36 | id: sqlfluff_json |
42 | 37 | if: steps.get_files_to_lint.outputs.lintees != '' |
43 | | - shell: bash -l {0} |
| 38 | + shell: bash |
44 | 39 | run: sqlfluff lint --format github-annotation --annotation-level failure --nofail ${{ steps.get_files_to_lint.outputs.lintees }} > annotations.json |
45 | 40 | - name: Annotate |
46 | | - uses: yuzutech/annotations-action@v0.3.0 |
| 41 | + uses: yuzutech/annotations-action@v0.5.0 |
47 | 42 | with: |
48 | 43 | repo-token: "${{ secrets.GITHUB_TOKEN }}" |
49 | 44 | title: "SQLFluff Lint" |
|
0 commit comments