[英]Github action did not make sqlfluff linting changes to a file
我正在嘗試按照本示例中的示例進行一些細微更改,從而為 dbt 文件設置 sqlfluff linting。 我的 github 動作 yml 文件如下所示:
name: Run sqlfluff linter
on:
push:
branches:
- main
- sqlfluff_ga2
jobs:
sql-lint:
name: runner / sqlfluff (github-check)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: yu-iskw/action-sqlfluff@v3
id: lint-sql
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
sqlfluff_version: "1.2.0"
sqlfluff_command: "lint" # Or "fix"
config: "${{ github.workspace }}/.sqlfluff"
paths: '${{ github.workspace }}/models'
github_base_ref: "main"
- name: 'Show outputs (Optional)'
shell: bash
run: |
echo '${{ steps.lint-sql.outputs.sqlfluff-results }}' | jq -r '.'
echo '${{ steps.lint-sql.outputs.sqlfluff-results-rdjson }}' | jq -r '.'
這是我的.sqlfluff
規則:
[sqlfluff]
dialect = bigquery
# L031 - Exclude rule requiring fully-qualified table names in joins
# should have been disabled for BigQuery already
# L036 - multiple SELECT columns can appear on the SELECT line
# L051 - Exclude rule requiring INNER JOIN rather than just JOIN
# L003 - Ignore whitespace problems for now
# L034 - Don't move around columns
# L016 - Long lines are fine
# L009 - No need for a single newline at end of file
# L008 - No need for spaces around commas
exclude_rules = L051,L031,L036,L003,L034,L016,L009,L008
[sqlfluff:rules:L010]
# Keywords
capitalisation_policy = upper
最后是一個測試 sql 文件內容,它位於 dbt 文件結構的模型文件夾中:
select
t.table_catalog t_catalog,
t.table_schema t_schema,
t.table_name t_name,
t.table_type t_type,
c.column_name c_name,
c.data_type d_type
FROM "{{ database }}".information_schema.tables t
inner JOIN "{{ database }}".information_schema.columns c
on c.table_schema = t.table_schema
and c.table_name = t.table_name
where t.table_catalog = '{{ database.upper() }}'
and t.table_type in ('BASE TABLE', 'VIEW') and t.table_schema = '{{ schema.upper() }}' and t.table_name = '{{ alias.upper() }}'
ORDER BY t.table_schema,
t.table_name;
github 動作運行成功,但是,sql 文件掉毛不固定。 沒有大寫或添加AS
別名。 這是我看到的 output:
我想知道是否有人可以幫助我了解發生了什么。
我猜您沒有將測試 sql 文件中的任何更改一起推送。 yu-iskw/action-sqlfluff 僅測試更改/添加的文件為https://github.com/yu-iskw/action-sqlfluff/blob/main/entrypoint.sh#L16
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.