Skip to content

Commit

Permalink
ci(github): do not use outdated output syntax anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed Jan 13, 2025
1 parent 383965b commit 2336590
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions .github/workflows/sqlfluff-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,21 @@ jobs:
- name: install sqlfluff
run: "pip install sqlfluff"
- name: Get changed files
id: get_file_changes
uses: trilom/[email protected]
id: changed-files
uses: tj-actions/changed-files@v42
with:
output: " "

files: |
src/queries/**/*.sql
files_ignore: |
**/common*.sql
- name: Get changed .sql files in /src/queries to lint
id: get_files_to_lint
shell: bash -l {0}
run: |
# Set the command in the $() brackets as an output to use in later steps
echo "::set-output name=lintees::$(
# Issue where grep regular expressions don't work as expected on the
# Github Actions shell, check dbt/models/ folder
echo \
$(echo ${{ steps.get_file_changes.outputs.files_modified }} |
tr -s ' ' '\n' |
grep -E '^src/queries.*[.]sql$' |
# ignore files containing 'common' in the file name
grep -v 'common' |
tr -s '\n' ' ') \
$(echo ${{ steps.get_file_changes.outputs.files_added }} |
tr -s ' ' '\n' |
grep -E '^src/queries.*[.]sql$' |
tr -s '\n' ' ')
)"
LINTEES="${{ steps.changed-files.outputs.all_changed_files }}"
echo "lintees=${LINTEES}" >> $GITHUB_OUTPUT
- name: Lint dbt models
id: sqlfluff_json
if: steps.get_files_to_lint.outputs.lintees != ''
shell: bash -l {0}
run: sqlfluff lint --format github-annotation --annotation-level failure --nofail ${{ steps.get_files_to_lint.outputs.lintees }} > annotations.json
- name: Annotate
uses: yuzutech/[email protected]
Expand Down

0 comments on commit 2336590

Please sign in to comment.