Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

args does not evaluate file globs #200

Open
2 of 3 tasks
JonasCir opened this issue Jan 29, 2022 · 0 comments
Open
2 of 3 tasks

args does not evaluate file globs #200

JonasCir opened this issue Jan 29, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@JonasCir
Copy link

Do the checklist before filing an issue:

Description

First, thanks for creating these actions, super helpful!

In my project, I have a couple of rust files which are there as test resources, however, I want them to be automatically checked by cargo fmt as well. Since they are not attached to any project, I need to pass the file paths directly to rustfmt.

cargo fmt -- tests/resources/**/*.rs --check works perfectly fine from my shell but it appears that this action does not expand glob patterns, which causes the following action to fail.

Workflow code

      - name: Run cargo fmt on tests resources
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: -- tests/resources/**/*.rs --check

Action output

Run actions-rs/cargo@v1
/home/runner/.cargo/bin/cargo fmt -- tests/resources/**/*.rs --check
Error: file `tests/resources/**/*.rs` does not exist
Error: The process '/home/runner/.cargo/bin/cargo' failed with exit code 1

Expected behavior

Glob patterns are expanded and the action checks all files.

Additional context

I found a way around it:

      - name: Gather test resources
        run: echo "TEST_RESOURCES_RUST=$(ls tests/resources/**/*.rs | tr '\n' ' ')" >> $GITHUB_ENV

      - name: Run cargo fmt on tests resources
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: -- ${{ env.TEST_RESOURCES_RUST }} --check
@JonasCir JonasCir added the bug Something isn't working label Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant