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

Create .pre-commit-hooks.yaml #258

Merged
merged 1 commit into from
Dec 28, 2024
Merged

Conversation

rsrdesarrollo
Copy link
Contributor

Allows to use Yamale as a pre-commit hook as follows:

    - repo: https://github.com/rsrdesarrollo/Yamale
      rev: 'c03ebfc703f557eb5af1b7ef895482b754ce0395'
      hooks:
        - id: yamale-schema-verify
          name: yamale-schema-verify
          files: 'data/.*'
          args: ["-s", "schemas/sample.yaml", "data"]

@cblakkan cblakkan merged commit a729a86 into 23andMe:master Dec 28, 2024
4 checks passed
@thiagowfx
Copy link
Contributor

thiagowfx commented Dec 28, 2024

Note that it's more idiomatic to have pass_filenames: true.
Then you can use --all-files as in pre-commit run [--all-files] yamale-schema-verify.
This is how my config is with your PR:

  - repo: https://github.com/23andMe/Yamale
    rev: ec646c5fab03929fb4ed1e9f6266d8dfaa5d1185  # Use SHA until 5.2.2 is released.
    hooks:
      - id: yamale-schema-verify
        alias: yamale-argocd-app
        files: apps/base
        pass_filenames: true
        types:
          - yaml
        exclude: (/kustomization.yaml$|values.yaml$|/manifests/|scaffolding/)
        args:
          - --no-strict
          - --schema
          - ci/yamale/argocd-application-schema.yaml

@thiagowfx
Copy link
Contributor

But now I realize that, at the time, pass_filenames: false was the only way, before #251 was merged.

Let me send a follow-up PR to incorporate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants