Skip to content

credfeto/action-sql-format

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Reformat SQL Files

How to use it?

This is a GitHub action, so it has to be added to a GitHub workflow.

A simple example of running this action on all pushes to the repository would be to add a reformatsql.yml file under .github/workflows with the following content

on: [push]

jobs:
  reformat-sql:
    runs-on: ubuntu-latest
    steps:
      # Checkout the source code there are have some files to look at.
      - uses: actions/[email protected]
        with:
          fetch-depth: 0
          token: ${{secrets.SOURCE_PUSH_TOKEN}}
          
      # Run the reformat action
      - name: Reformat SQL Files
        uses: credfeto/[email protected]
        
      # Commit any changes to the repo
      - uses: stefanzweifel/[email protected]
        with:
          commit_message: "[Reformat] SQL Files to common format"
          file_pattern: "*.sql"
          commit_user_name: "sqlfmt[bot]"
          commit_user_email: "[email protected]"
          commit_author: "sqlfmt[bot] <[email protected]>"
          skip_dirty_check: false

On each push, it will reformat the SQL. Note you'll need to commit and push any commits back to your GithHub repo.

Contributors