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

check: support directory scan #28

Closed
Dentrax opened this issue Jun 3, 2022 · 2 comments
Closed

check: support directory scan #28

Dentrax opened this issue Jun 3, 2022 · 2 comments
Labels
enhancement New feature

Comments

@Dentrax
Copy link

Dentrax commented Jun 3, 2022

TL;DR

It would be nice to support directory inputs for check subcommand:

$ ratchet check .github/workflows/
failed to parse .github/workflows/: failed to decode yaml: yaml: input error: read .github/workflows/: is a directory

Detailed design

If given arg is directory, traverse all `.yml | .yaml` files (it's ok to ignore symlinks for now).

If given arg is file, it should work as is.

Example output format:

[PASS] .github/workflows/foo.yaml
[FAIL] .github/workflows/bar.yaml
[PASS] .github/workflows/baz.yaml

Additional information

No response

@Dentrax Dentrax added the enhancement New feature label Jun 3, 2022
@sethvargo
Copy link
Owner

Hi @Dentrax

This gets really complex with authentication, so I would prefer not to support a collection of files. Instead, you can use unix commands like find an xargs to accomplish this:

find . -name '*.yml' -exec ratchet check {} \;

Dentrax added a commit to Dentrax/ratchet that referenced this issue Jun 3, 2022
Fixes sethvargo#28

Signed-off-by: Furkan <furkan.turkal@trendyol.com>
Co-authored-by: Batuhan <batuhan.apaydin@trendyol.com>
@Dentrax
Copy link
Author

Dentrax commented Jun 3, 2022

Yes, I've tried the same method to scan directory but if we want to implement this in the CI, things get complicated since our entry point is ratchet in Docker image. So I want to use the following use-case scenario. Notice that we can not use the way you provided above.

# Example of checking all versions under .github/workflows/ are pinned.
      - uses: 'docker://ghcr.io/sethvargo/ratchet:0.2.3'
        with:
          args: 'check .github/workflows/'

We created a simple PR anyway 🤷‍♂️ #29 (@developer-guy)

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

Successfully merging a pull request may close this issue.

2 participants