From aa8bd44c6dc7a86db975d7a8065c09b501e8a5fe Mon Sep 17 00:00:00 2001 From: Wyatt Stanke Date: Wed, 21 Feb 2024 15:39:33 -0500 Subject: [PATCH] YAMLLint, yamlfmt, and auto-formatting --- .github/workflows/lint.yml | 15 +++++++++++++++ .yamlfmt | 4 ++++ .yamllint | 9 +++++++++ 3 files changed, 28 insertions(+) create mode 100644 .yamlfmt create mode 100644 .yamllint diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b38491c2..ff106ab4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,7 +4,22 @@ name: Lint on: [push, pull_request] # yamllint disable-line rule:truthy jobs: + yaml-fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + - uses: actions/setup-go@v4 + - run: go install github.com/google/yamlfmt/cmd/yamlfmt@latest + - run: yamlfmt . + - uses: EndBug/add-and-commit@v9 + with: + message: "yamllint: auto-format" + default_author: github_actions yaml-lint: + needs: yaml-fmt runs-on: ubuntu-latest steps: - name: Check out source repository diff --git a/.yamlfmt b/.yamlfmt new file mode 100644 index 00000000..650063d6 --- /dev/null +++ b/.yamlfmt @@ -0,0 +1,4 @@ +formatter: + type: basic + include_document_start: true + max_line_length: 127 \ No newline at end of file diff --git a/.yamllint b/.yamllint new file mode 100644 index 00000000..092943ba --- /dev/null +++ b/.yamllint @@ -0,0 +1,9 @@ +--- +extends: default + +rules: + line-length: + max: 127 + truthy: + # GitHub Actions + check-keys: false \ No newline at end of file