Skip to content
This repository was archived by the owner on May 10, 2025. It is now read-only.

Commit fb3a4d6

Browse files
feat(workflows): Add yamllint workflow (#38)
* add reusable yamllint job * add yamllint config * call yamllint job * fix lint * fix job name
1 parent 27887d9 commit fb3a4d6

File tree

4 files changed

+96
-1
lines changed

4 files changed

+96
-1
lines changed

.github/workflows/lint-job.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
3+
name: Lint
4+
5+
on:
6+
workflow_dispatch: {}
7+
8+
pull_request:
9+
paths:
10+
- "*.yaml"
11+
12+
jobs:
13+
yamllint:
14+
uses: ./.github/workflows/reusable-yamllint.yaml
15+
secrets: inherit
16+
with:
17+
yamllint-args: "--config-file=.yamllint.yaml"

.github/workflows/reusable-go-lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
type: string
1515
description: The version of golangci-lint to use.
1616
required: false
17-
default: "v1.60" #TODO add renovate annotation
17+
default: "v1.60" # TODO add renovate annotation
1818
golangci-args:
1919
type: string
2020
description: Additional arguments to pass to golangci
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
3+
name: Reusable - GolangCI Lint
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
python-version:
9+
type: string
10+
description: The Python version to use.
11+
required: false
12+
default: "3.12"
13+
yamllint-version:
14+
type: string
15+
description: The version of yamllint to use.
16+
required: false
17+
default: "1.35.1"
18+
yamllint-args:
19+
type: string
20+
description: Additional arguments to pass to yamllint.
21+
required: false
22+
default: ""
23+
working-directory:
24+
type: string
25+
description: The directory to lint.
26+
required: false
27+
default: "."
28+
29+
jobs:
30+
lint:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Generate Token
34+
uses: actions/create-github-app-token@3378cda945da322a8db4b193e19d46352ebe2de5 # v1.10.4
35+
id: app-token
36+
with:
37+
app-id: "${{ secrets.BOT_APP_ID }}"
38+
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
39+
40+
- name: Checkout
41+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
42+
with:
43+
token: "${{ steps.app-token.outputs.token }}"
44+
45+
- name: Set up Python
46+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
47+
with:
48+
python-version: "${{ inputs.python-version }}"
49+
50+
- name: Install yamllint
51+
run: pip install yamllint==${{ inputs.yamllint-version }}
52+
53+
- name: Run yamllint
54+
run: yamllint ${{ inputs.yamllint-args }} ${{ inputs.working-directory }}

.yamllint.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
# yaml-language-server: $schema=https://json.schemastore.org/yamllint.json
3+
extends: default
4+
5+
rules:
6+
comments:
7+
min-spaces-from-content: 1
8+
9+
line-length:
10+
max: 150
11+
12+
braces:
13+
level: warning
14+
max-spaces-inside: 1
15+
16+
brackets:
17+
level: warning
18+
max-spaces-inside: 1
19+
20+
# Ignore truthy for github workflows due to dummy trigger on the
21+
# 'on:' clause
22+
truthy:
23+
ignore:
24+
- .github/workflows

0 commit comments

Comments
 (0)