Hey guys I have my sqlfluff.yml file ready and it is running fine.:
name: sqlfluff with reviewdog
on:
pull_request:
jobs:
test-check:
name: runner / sqlfluff (github-check)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: yu-iskw/action-sqlfluff@v3
id: lint-sql
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
sqlfluff_version: '1.4.5'
sqlfluff_command: 'fix' # Or "lint"
dialect: clickhouse
exclude_rules: L051,L031,L036,L003,L034,L016,L009,L008,L039
paths: '${{ github.workspace }}/models'
- name: 'Show outputs'
shell: bash
run: |
echo '${{ steps.lint-sql.outputs.sqlfluff-results }}' | jq -r '.'
echo '${{ steps.lint-sql.outputs.sqlfluff-results-rdjson }}' | jq -r '.'
It is outlining the issues in the Actions section. I was wondering If I could make it outline them in the comments section of the PR like this:
name: sqlfluff with reviewdog
on:
pull_request:
jobs:
test-check:
name: runner / sqlfluff (github-check)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# only run when a comment requests linting
- uses: khan/pull-request-comment-trigger@master
id: check
with:
trigger: '/lint'
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- uses: yu-iskw/action-sqlfluff@v3
if: steps.check.outputs.triggered == 'true'
id: lint-sql
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
sqlfluff_version: "0.11.1"
However I want this to be done automatically whenever I create a PR rather than adding a '/lint
' comment as a trigger in my PR. Is there a specific action for this ? or specific method I should use in my .yml file?