Skip to content

A GitHub Action to run pgrubic, a PostgreSQL linter and formatter for schema migrations and design best practices.

License

Notifications You must be signed in to change notification settings

azellarhq/pgrubic-action

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgrubic-action

pgrubic-action Version License: MIT CI release

A GitHub Action to run pgrubic, a PostgreSQL linter and formatter for schema migrations and design best practices.

This action runs pgrubic lint --generate-lint-report by default, but it can do anything pgrubic can.

Commenting on pull requests

This action, by default, comments with lint reports on pull requests on pull_request events and therefore requires the necessary permissions for publishing new comments in pull requests.

permissions:
  # Gives the action the necessary permissions for publishing new
  # comments in pull requests.
  pull-requests: write

Inputs

Input Description Default
args The arguments to pass to the pgrubic command. See Running pgrubic. lint --generate-lint-report
pgrubic-version The version of pgrubic to use, e.g., 0.9.0. latest
src The directory or files to run pgrubic on. github.workspace

Outputs

Output Description
installed-pgrubic-version The version of the installed pgrubic.

Usage

Basic

- uses: azellarhq/pgrubic-action@v2

Specifying a different source directory

- uses: azellarhq/pgrubic-action@v2
  with:
    src: "./src"

Specifying multiple files

- uses: azellarhq/pgrubic-action@v2
  with:
    src: >-
      path/to/file1.sql
      path/to/file2.sql

Specifying multiple directories

- uses: azellarhq/pgrubic-action@v2
  with:
    src: >-
      path/to/dir1
      path/to/dir2

Specifying multiple files and directories

- uses: azellarhq/pgrubic-action@v2
  with:
    src: >-
      path/to/file1.sql
      path/to/file2.sql
      path/to/dir1
      path/to/dir2

To install pgrubic

This action adds pgrubic to the PATH, so you can use it in subsequent steps.

- uses: azellarhq/pgrubic-action@v2
- run: pgrubic lint
- run: pgrubic format

By default, this action runs pgrubic lint after installation. If you do not want to run any pgrubic command but only install it, you can use the args input to overwrite the default option (lint):

- name: Install pgrubic without running lint or format
  uses: azellarhq/pgrubic-action@v2
  with:
    args: "--version"

Use pgrubic format

- uses: azellarhq/pgrubic-action@v2
  with:
    args: "format --check --diff"

Install a specific version of pgrubic

- uses: azellarhq/pgrubic-action@v2
  with:
    pgrubic-version: "0.6.0"

Install the latest version of pgrubic

- uses: azellarhq/pgrubic-action@v2
  with:
    pgrubic-version: "latest"

Contributing

We welcome and greatly appreciate contributions. If you would like to contribute, please see the contributing guidelines.

Support

Encountering issues? Take a look at the existing GitHub issues, and don't hesitate to open a new one.

License

MIT license.

About

A GitHub Action to run pgrubic, a PostgreSQL linter and formatter for schema migrations and design best practices.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •