Skip to content

ast-grep/action

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

ast-grep/action

A GitHub Action to run ast-grep linting!

image

See a more detailed setup guide in ast-grep's tooling guide.

Inputs

version

Optional The version of ast-grep to use in the action. Default is latest.

config

Optional The file path to ast-grep's project config relative to root dir. Default is sgconfig.yml.

paths

Optional File paths string, corresponding to PATHS passed to the ast-grep cli, to limit the paths the action runs on. Multiple file paths can be delimited by whitespaces.

Example usage

Basic

on: [push]

jobs:
  sg-lint:
    runs-on: ubuntu-latest
    name: Run ast-grep lint
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: ast-grep lint step
        uses: ast-grep/action@latest

Advanced

on: [push]

jobs:
  sg-lint:
    runs-on: ubuntu-latest
    name: Run ast-grep lint
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: ast-grep lint step
        uses: ast-grep/action@latest
        with:
          version: 0.17.1
          config: sgconfig.yml
          paths: src lib