This action checks all the desired files and runs a check using pgsql-parser to find possible syntax errors.
- The list of files SQL Guardian should look to find possible syntax errors
- The list of errors found during the execution, a string separating errors by "\n". If no errors are found, the output is a default "not found" message.
- SQL Guardian currently supports only PostgreSQL using npm's pgsql-parser
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Run SQL Guardian
id: sql_guardian
uses: geomais/sql-guardian@main
with:
sql_files: ./files/database.sql .files/tables.sql
- name: Comment PR with possible SQL syntax errors
uses: thollander/actions-comment-pull-request@v3
with:
comment-tag: execution
message: "## 🛠️ SQL Syntax Check Report\n\n${{ steps.sql_guardian.outputs.sql_errors }}"