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

feat(workflows): Add yamllint workflow #38

Merged
merged 5 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 17 additions & 0 deletions .github/workflows/lint-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Lint

on:
workflow_dispatch: {}

pull_request:
paths:
- "*.yaml"

jobs:
yamllint:
uses: ./.github/workflows/reusable-yamllint.yaml
secrets: inherit
with:
yamllint-args: "--config-file=.yamllint.yaml"
2 changes: 1 addition & 1 deletion .github/workflows/reusable-go-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
type: string
description: The version of golangci-lint to use.
required: false
default: "v1.60" #TODO add renovate annotation
default: "v1.60" # TODO add renovate annotation
golangci-args:
type: string
description: Additional arguments to pass to golangci
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/reusable-yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Reusable - GolangCI Lint

on:
workflow_call:
inputs:
python-version:
type: string
description: The Python version to use.
required: false
default: "3.12"
yamllint-version:
type: string
description: The version of yamllint to use.
required: false
default: "1.35.1"
yamllint-args:
type: string
description: Additional arguments to pass to yamllint.
required: false
default: ""
working-directory:
type: string
description: The directory to lint.
required: false
default: "."

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: actions/create-github-app-token@3378cda945da322a8db4b193e19d46352ebe2de5 # v1.10.4
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
token: "${{ steps.app-token.outputs.token }}"

- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "${{ inputs.python-version }}"

- name: Install yamllint
run: pip install yamllint==${{ inputs.yamllint-version }}

- name: Run yamllint
run: yamllint ${{ inputs.yamllint-args }} ${{ inputs.working-directory }}
24 changes: 24 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/yamllint.json
extends: default

rules:
comments:
min-spaces-from-content: 1

line-length:
max: 150

braces:
level: warning
max-spaces-inside: 1

brackets:
level: warning
max-spaces-inside: 1

# Ignore truthy for github workflows due to dummy trigger on the
# 'on:' clause
truthy:
ignore:
- .github/workflows