Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YAMLLint to CI #1933

Merged
merged 10 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
with:
filters: |
md: [ '**.md' ]
yml: [ '**.yml, '**.yaml', '.yamllint' ]
mowies marked this conversation as resolved.
Show resolved Hide resolved
build: ['build/**', '.github/**/*.yml', '!.github/workflows/package-*', '**/*.targets', '**/*.props']
shared: ['src/Shared/**', 'test/Shared/**']
contrib-shared-tests: ['test/OpenTelemetry.Contrib.Shared.Tests/**']
Expand Down Expand Up @@ -68,6 +69,13 @@ jobs:
|| contains(needs.detect-changes.outputs.changes, 'build')
uses: ./.github/workflows/markdownlint.yml

lint-yml:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'yml')
|| contains(needs.detect-changes.outputs.changes, 'build')
uses: ./.github/workflows/yamllint.yml

lint-dotnet-format:
needs: detect-changes
if: |
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint - YAML

on:
workflow_call:

jobs:
run-yamllint:
runs-on: ubuntu-latest

steps:
- name: check out code
uses: actions/checkout@v4

- name: install yamllint
run: pip install yamllint

- name: run yamllint
run: yamllint .
22 changes: 22 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
extends: default

ignore-from-file: [.gitignore]

rules:
document-start: disable
octal-values: enable
truthy:
allowed-values: ['true', 'false', 'on'] # 'on' for GH action trigger
line-length:
max: 200
indentation:
check-multi-line-strings: false
indent-sequences: consistent
brackets:
max-spaces-inside: 1
max-spaces-inside-empty: 0
braces:
max-spaces-inside: 1
max-spaces-inside-empty: 0
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ If you made changes to the Markdown documents (`*.md` files), install the latest
markdownlint .
```

If you made changes to any YAML files (`*.yaml` or `*.yml` files), install the latest
[`yamllint`](https://github.com/adrienverge/yamllint) and run:

```sh
yamllint .
```

Check out a new branch, make modifications and push the branch to your fork:

```sh
Expand Down
Loading