From b72ee62bc2c1f3fd1b6f1119db4254c7448de3a6 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 7 Feb 2024 21:00:25 -0800 Subject: [PATCH] Add yamllint --- .github/labeler.yml | 31 ++++++++++++++++--------------- .github/workflows/lint.yml | 19 ++++++++++++++++--- .github/workflows/scorecards.yml | 2 +- .goreleaser.yml | 12 ++++++------ .yamllint.yaml | 22 ++++++++++++++++++++++ 5 files changed, 61 insertions(+), 25 deletions(-) create mode 100644 .yamllint.yaml diff --git a/.github/labeler.yml b/.github/labeler.yml index 6bb26dbe..9506c2c4 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,30 +1,31 @@ change: - - head-branch: ['^change/'] + - head-branch: ["^change/"] enhancement: - - head-branch: ['^feature/', '^feat/', '^enhancement/', '^enh/'] + - head-branch: ["^feature/", "^feat/", "^enhancement/", "^enh/"] bug: - - head-branch: ['^fix/', '^bug/'] + - head-branch: ["^fix/", "^bug/"] chore: - - head-branch: ['^chore/'] + - head-branch: ["^chore/"] tests: -- any: - - head-branch: ['^tests/', '^test/'] - - changed-files: - - any-glob-to-any-file: 'tests/**/*' -- all: - - changed-files: - - all-globs-to-all-files: ['!tests/requirements.txt'] + - any: + - head-branch: ["^tests/", "^test/"] + - changed-files: + - any-glob-to-any-file: "tests/**/*" + - all: + - changed-files: + - all-globs-to-all-files: ["!tests/requirements.txt"] documentation: - - head-branch: ['^docs/', '^doc/'] + - head-branch: ["^docs/", "^doc/"] - changed-files: - - any-glob-to-any-file: '**/*.md' + - any-glob-to-any-file: "**/*.md" dependencies: - - head-branch: ['^deps/', '^dep/', '^dependabot/', 'pre-commit-ci-update-config'] + - head-branch: + ["^deps/", "^dep/", "^dependabot/", "pre-commit-ci-update-config"] - changed-files: - - any-glob-to-any-file: ['go.mod', 'go.sum'] + - any-glob-to-any-file: ["go.mod", "go.sum"] diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 415de584..1edcaf0d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,9 +4,10 @@ on: pull_request: branches: - main - paths-ignore: - - "examples/**" - - "**.md" + +defaults: + run: + shell: bash concurrency: group: ${{ github.ref_name }}-lint @@ -54,3 +55,15 @@ jobs: config: .markdownlint-cli2.yaml globs: "**/*.md" fix: false + + yaml-lint: + name: YAML lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install yamllint + run: pip install yamllint + + - name: Lint YAML files + run: yamllint . diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index a41a0b9a..eb38b3ad 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -1,6 +1,6 @@ name: OpenSSF Scorecards on: - branch_protection_rule: + branch_protection_rule: # yamllint disable-line rule:empty-values schedule: - cron: "36 15 * * 3" # run every Wednesday at 15:36 UTC push: diff --git a/.goreleaser.yml b/.goreleaser.yml index 34a50b53..2b6b94ae 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -3,7 +3,7 @@ env: before: hooks: - - make LICENSES + - make LICENSES builds: - id: nginx-asg-sync @@ -97,7 +97,7 @@ signs: - cmd: cosign artifacts: checksum output: true - certificate: '${artifact}.pem' + certificate: "${artifact}.pem" args: - sign-blob - "--output-signature=${signature}" @@ -108,14 +108,14 @@ signs: announce: slack: enabled: true - channel: '#announcements' - message_template: 'NGINX Plus Integration with Cloud Autoscaling {{ .Tag }} is out! Check it out: {{ .ReleaseURL }}' + channel: "#announcements" + message_template: "NGINX Plus Integration with Cloud Autoscaling {{ .Tag }} is out! Check it out: {{ .ReleaseURL }}" milestones: - close: true snapshot: - name_template: 'edge' + name_template: "edge" snapcrafts: - summary: NGINX Plus Integration with Cloud Autoscaling @@ -125,7 +125,7 @@ snapcrafts: grade: devel confinement: strict publish: true - license: 'BSD 2-Clause' + license: "BSD 2-Clause" apps: nginx-asg-sync: command: nginx-asg-sync diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 00000000..7d0320c4 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,22 @@ +--- +yaml-files: + - "*.yaml" + - "*.yml" + +ignore-from-file: .gitignore + +extends: default + +rules: + comments: + min-spaces-from-content: 1 + comments-indentation: enable + document-start: disable + empty-values: enable + line-length: + max: 120 + ignore: | + .goreleaser.yml + .github/ + truthy: + check-keys: false