Skip to content
play

GitHub Action

YAML file linter

0.1.0 Latest version

YAML file linter

play

YAML file linter

Lint a YAML file in your project

Installation

Copy and paste the following snippet into your .yml file.

              

- name: YAML file linter

uses: jacobtomlinson/gha-lint-yaml@0.1.0

Learn more about this action in jacobtomlinson/gha-lint-yaml

Choose a version

YAML linter Action

GitHub Marketplace Actions Status Actions Status

This action will lint YAML files in your project.

Usage

Describe how to use your action here.

Example workflow

name: My Workflow
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Run action
      uses: jacobtomlinson/gha-lint-yaml@master
      with:
        path: path/to/my/yaml/file.yaml

Inputs

Input Description
path Path to the YAML file to be linted.
strict (optional) Run the linter in strict mode (error on warnings).

Outputs

Output Description
warnings The number of warnings raised if successful.

Examples

Running in strict mode

Here is an example of a very strict linting job.

name: My Workflow
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Run action
      uses: jacobtomlinson/gha-lint-yaml@master
      with:
        path: path/to/my/yaml/file.yaml
        strict: true

Using outputs

Here is an example of using the warnings outputs.

name: My Workflow
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Run action
      id: yamllint
      uses: jacobtomlinson/gha-lint-yaml@master
      with:
        path: path/to/my/yaml/file.yaml

    - name: Check outputs
        run: |
          echo "There were ${{ steps.yamllint.outputs.warnings }} YAML linting warnings."