Git Product home page Git Product logo

yaml-lint's Introduction

yamllint-github-action

Yamllint GitHub Actions allow you to execute yamllint command within GitHub Actions.

The output of the actions can be viewed from the Actions tab in the main repository view. If the actions are executed on a pull request event, a comment may be posted on the pull request.

Yamllint GitHub Actions is a single GitHub Action that can be executed on different directories depending on the content of the GitHub Actions YAML file.

Success Criteria

An exit code of 0 is considered a successful execution.

Usage

The most common usage is to run yamllint on a file/directory. A comment will be posted to the pull request depending on the output of the Yamllint command being executed. This workflow can be configured by adding the following content to the GitHub Actions workflow YAML file.

name: 'Yamllint GitHub Actions'
on:
  - pull_request
jobs:
  yamllint:
    name: 'Yamllint'
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout'
        uses: actions/checkout@master
      - name: 'Yamllint'
        uses: karancode/yamllint-github-action@master
        with:
          yamllint_file_or_dir: '<yaml_file_or_dir>'
          yamllint_strict: false
          yamllint_comment: true
        env:
          GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

This was a simplified example showing the basic features of this Yamllint GitHub Actions.

Inputs

Inputs configure Yamllint GitHub Actions to perform lint action.

Parameter Default Description
yamllint_file_or_dir . (Optional) The file or directory to run yamllint on (assumes that the directory contains *.yaml file)
yamllint_strict false (Optional) Yamllint strict option.
yamllint_config_filepath empty (Optional) Path to a custom config file.
yamllint_config_datapath empty (Optional) Custom configuration (as YAML source).
yamllint_format auto (Optional) Format for parsing.
yamllint_comment false (Optional) Comment on GitHub pull requests, possible are true,false

Outputs

Outputs are used to pass information to subsequent GitHub Actions steps.

  • yamllint_output - The Yamllint build outputs.

Secrets

Secrets are similar to inputs except that they are encrypted and only used by GitHub Actions. It's a convenient way to keep sensitive data out of the GitHub Actions workflow YAML file.

  • GITHUB_ACCESS_TOKEN - (Optional) The GitHub API token used to post comments to pull requests. Not required if the yamllint_comment input is set to false.

Development

Testing

For testing the bats testing framework is used. Tests can be run with ./tests/run.bats but first you need to install bats.

yaml-lint's People

Contributors

sandeeprapido avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.