adrienverge / yamllint

A linter for YAML files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False positive with github actions yaml

dosas opened this issue · comments

---
on:
  push:
    tags: ['**']
...

When running

 yamllint --strict 

Actual:
warning truthy value should be one of [false, true] (truthy)

Expected:
No warning

@adrienverge Could you be a little bit more verbose about it?

@dosas this is an issue report with a lot of duplicates (e.g. #430). It's not a problem, it's intended default behavior.

Your options are:

  1. Quote the key

    ---
    name: Run tests
    
    "on": [push, pull_request]
  2. Disable the rule with a line comment

    ---
    name: Run tests
    
    on: [push, pull_request]  # yamllint disable-line rule:truthy
  3. Disable key checking in the yamllint configuration (e.g. .yamllint.yaml)

    ---
    extends: default
    rules:
      truthy:
        check-keys: false

Thanks @andrewimeson 🙏

Since #650 and yamllint 1.34.0 there is yet another solution: declare the YAML version explicitly:

%YAML 1.2
---
name: Run tests

on: [push, pull_request]