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

Escaped file names #130

Open
peterbe opened this issue Jan 10, 2022 · 1 comment
Open

Escaped file names #130

peterbe opened this issue Jan 10, 2022 · 1 comment

Comments

@peterbe
Copy link

peterbe commented Jan 10, 2022

Is your feature request related to a problem? Please describe.
Escaping names.

Imaging a PR that contains a change to a file that has brackets in it. E.g. foo-(bar).md
And in my Actions workflow I do this:

  - run: ls ${{ steps.get_diff_files.outputs.files }}

what that translates to is:

  - run: ls foo-(bar).md

which will fail with:

no matches found: foo-(bar).md

But if it was escaped, it would work:

$ touch "foo-(bar).md"
$ ls -l "foo-(bar).md"
-rw-r--r--  1 peterbe  wheel  0 Jan 10 09:52 foo-(bar).md

You can't change the workflow Yaml to...

  - run: ls "${{ steps.get_diff_files.outputs.files }}"

because although bash would no longer crash, you'd end up with multiple files being treated as one long string with a space in it.
E.g.

  - run: ls "foo-(bar).md other.file and/another/file.md"

Describe the solution you'd like
That the string outputs.files escaped each and every file.
Perhaps something like this:

      - name: Gather files changed
        uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b
        id: get_diff_files
        with:
          escapeEachFile: true

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@peterbe
Copy link
Author

peterbe commented Jan 10, 2022

I use zsh but I think it's the same as bash. You can either escape each filename with quotation marks, but you can also just use \ on each control character that's problematic. E.g. ls foo-\(bar\).md will work the same as ls "foo-(bar).md". No idea which one is best.

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

No branches or pull requests

1 participant