Skip to content

ast-grep GH Action

Actions
A GH Action to run ast-grep custom rules
v1
Latest
Star (6)

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

ast-grep GH Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

A GH Action to run ast-grep custom rules
v1
Latest

ast-grep GH Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.