ibiqlik / action-yamllint

GitHub Action - Yaml Lint
MIT License
97 stars 41 forks source link

Ignore linting files in .git/ #8

Closed kenorb closed 4 years ago

kenorb commented 4 years ago
Run ibiqlik/action-yamllint@master
  with:
    strict: true
    format: colored

======================
= Linting YAML files =
======================
./.git/refs/remotes/origin/optimize-strategy-ac.yml
  1:1       warning  missing document start "---"  (document-start)

./.git/logs/refs/remotes/origin/optimize-strategy-ac.yml
  1:121     warning  line too long (288 > 120 characters)  (line-length)
  1:176     error    syntax error: found character '\t' that cannot start any token (syntax)

Build: 869097594

It seems action is trying to lint files within .git it-self. Can this be disabled by default?

ibiqlik commented 4 years ago

By default yamllint checks every .yaml file in the path. To ignore certain paths you have two options

  1. Recommended: Add .yamllint file in your root git repository and set your desired behavior, like ignoring paths, setting rules etc.
    
    ---
    extends: default

ignore: | .git /ignore/my/other/dir/


2. Use `config_data` in the GitHub action to specify configuration
```yaml
- uses: ibiqlik/action-yamllint@v1
  with:
    config_data: "{extends: default, ignore: .git}"

For more details on specific configuration of yamllint itself please refer to documentation, for this specific question look here https://yamllint.readthedocs.io/en/stable/configuration.html#ignoring-paths

kenorb commented 4 years ago

Thanks, I'll test suggested approach.