diff --git a/.github/workflows/grit-check.yaml b/.github/workflows/grit-check.yaml new file mode 100644 index 0000000..1b7cd59 --- /dev/null +++ b/.github/workflows/grit-check.yaml @@ -0,0 +1,21 @@ +name: grit-check-pre-release + +on: + push: + branches: + - main + pull_request: + branches: + - '*' + workflow_dispatch: {} + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: grit-check + uses: ./ + with: + args: '.github' diff --git a/.grit/.gitignore b/.grit/.gitignore new file mode 100644 index 0000000..799e2c7 --- /dev/null +++ b/.grit/.gitignore @@ -0,0 +1,2 @@ +.gritmodules +*.log diff --git a/.grit/grit.yaml b/.grit/grit.yaml new file mode 100644 index 0000000..89729a8 --- /dev/null +++ b/.grit/grit.yaml @@ -0,0 +1,9 @@ +version: 0.0.1 +patterns: + - name: github.com/getgrit/stdlib#* + - name: use_ubuntu + description: 'This is a no-op warning meant for testing. You can ignore it.' + level: warn + body: | + language yaml + `runs-on: ubuntu-latest` => `runs-on: "ubuntu-latest"` \ No newline at end of file diff --git a/README.md b/README.md index 68d6238..a562e1a 100644 --- a/README.md +++ b/README.md @@ -1 +1,57 @@ -# github-action-check \ No newline at end of file +# Grit GitHub Action + +This action runs the Grit CLI to report any violations of your configured [Grit patterns](https://docs.grit.io/guides/config). + +## Usage + +You can add it as a step in your GitHub Actions workflow to automatically check for violations on every push: + +``` + - name: Grit + uses: getgrit/github-action-check@v0 + with: + # Optional additional arguments to pass to the `grit check` command + args: '' +``` + +## Inputs + +### `args` +Specify [additional arguments](https://docs.grit.io/cli/reference#grit-check) to pass to the `grit check` command. + +By default, only warning and error patterns are reported. To include info patterns, use `--level`. + +``` + - name: Grit + uses: getgrit/github-action-check@v0 + with: + args: '--level info' +``` + +## Example workflow + +``` +name: grit-check + +on: + push: + branches: + - main + pull_request: + branches: + - '*' + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: grit-check + uses: getgrit/github-action-check@v0 +``` + +## License +This action code is released under the [MIT License](LICENSE). + +The Grit CLI is not included in this repository and is licensed separately. diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..ca09d38 --- /dev/null +++ b/action.yaml @@ -0,0 +1,28 @@ +# Copyright (c) Iuvo AI, Inc. +# SPDX-License-Identifier: MIT +# +name: 'Grit Check' +description: 'Run Grit checks via GitHub actions' +inputs: + args: + description: 'Optional additional arguments to `grit check`' + required: false + default: '' +runs: + using: 'composite' + steps: + - name: install grit + shell: bash + id: download + run: | + curl -fsSL https://docs.grit.io/install | bash + - name: init grit + id: init + shell: bash + run: | + grit init + - name: run grit check + id: check + shell: bash + run: | + grit check --github-actions ${{ inputs.args }} \ No newline at end of file