Skip to content

Commit

Permalink
feat: initial action implementation (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante authored Dec 18, 2023
1 parent ff2de82 commit 8e6ec96
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .github/workflows/grit-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: grit-check-pre-release

on:
push:
branches:
- main
pull_request:
branches:
- '*'
workflow_dispatch: {}

jobs:
run:
runs-on: ubuntu-latest

Check warning on line 14 in .github/workflows/grit-check.yaml

View workflow job for this annotation

GitHub Actions / run

use_ubuntu

This is a no-op warning meant for testing. You can ignore it.
steps:
- name: Check out code
uses: actions/checkout@v4
- name: grit-check
uses: ./
with:
args: '.github'
2 changes: 2 additions & 0 deletions .grit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gritmodules
*.log
9 changes: 9 additions & 0 deletions .grit/grit.yaml
Original file line number Diff line number Diff line change
@@ -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"`
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
# github-action-check
# 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.
28 changes: 28 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 8e6ec96

Please sign in to comment.