Skip to content

Commit

Permalink
docs: Vale Reusable GitHub Action (#12)
Browse files Browse the repository at this point in the history
* fix: added recommended structure

* docs: added updates to the README and GitHub template
  • Loading branch information
karl-cardenas-coding authored Jun 24, 2024
1 parent be5c91d commit 32baa71
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
workflow_call:
inputs:
version:
description: "The version of the Vale to use"
default: "3.5.0"
type: string
required: false

jobs:
vale:
name: Writing Checks
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Vale Check
uses: errata-ai/vale-action@reviewdog
with:
filter_mode: added
reporter: github-pr-review
vale_flags: --glob=*.{md} --minAlertLevel=error
fail_on_error: false
version: ${{ inputs.version }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
78 changes: 77 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,83 @@ This repository contains the Vale package for Spectro Cloud documentation. The p

## Usage

TBD
Use the following steps to use the Spectro Cloud Vale package in your documentation.

1. Install Vale locally. You have multiple options to install Vale. For example, you can use Homebrew, Scoop, or Chocolatey. For more information, see the [Vale installation guide](https://vale.sh/docs/vale-cli/installation/).

```shell
brew install vale
```

2. In the repository where you want to use the Spectro Cloud Vale package, create a `.vale.ini` file and add the following configuration:

```yaml
StylesPath = vale/styles

MinAlertLevel = suggestion

Packages = https://github.com/spectrocloud/spectro-vale-pkg/releases/latest/download/spectrocloud-docs.zip
Vocab = spectrocloud-vocab

[*.md]
BasedOnStyles = Vale, spectrocloud-docs
```

3. In the repository `.gitignore` file, add the following line to ignore the Vale package files:

```shell
vale/styles/spectrocloud-docs/
vale/styles/config/vocabularies/spectrocloud-vocab
```

4. Initialize the Vale package in the repository:

```shell
vale sync
```

5. In the `.github/workflows` directory, create a new file titled `vale.yaml` and add the following configuration:

```yaml
name: Vale

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

concurrency:
group: vale-${{ github.ref }}
cancel-in-progress: true

jobs:
run-ci:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
if: ${{ !github.event.pull_request.draft && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' }}
steps:
- run: exit 0

vale:
needs: [run-ci]
uses: spectrocloud/spectro-vale-pkg/.github/workflows/vale.yml@main
```
You are now ready to use the Spectro Cloud Vale package in your documentation. The Vale package will run on every pull request and provide feedback on the documentation.
> [!TIP]
> Pull Requests in draft mode will not trigger the writting checks. Make sure to mark the PR as ready for review to trigger the checks.
If a pull request does not meet the standards, Vale will provide suggestions to improve the documentation.
If you want to run Vale locally, use the following command.
```shell
vale path/to/your/file
```

A detailed output will show the suggestions and errors in the documentation.

## Contribution

Expand Down

0 comments on commit 32baa71

Please sign in to comment.