Skip to content

pathspec is not respected because of bash expansion #239

@alexgarel

Description

@alexgarel

Version of the Action
v4.14.1

Describe the bug
I my workflow action,
I am converting jupyter notebook to markdown.
I want to commit all "md" files changed by previous steps in the repository
If I use file_pattern: "*.md", according to pathspec, it should commit every ".md" file it the repository but it does not work.

This is due to the fact that I have a Threshold.md file at the root of my repository, so *.md is expanded to Threshold.md before being send to git command.
I can reproduce it locally, if I use git status *.md, I only get status for Threshold.md,
while if I use git status "*.md", I get status for all ".md" file in the repository.

I tried to use filepattern: "'*.md'" but it did not work. I think quotes are lost during evaluation to pass it in ENV variable ($INPUT_FILE_PATTERN)

To Reproduce

  1. Create git repo with a structure:
  • a.md
  • subdir/b.md
  1. Add a step that modifies those files by eg. appending some value.
  2. Use the action to commit all md file with file_pattern: "*.md".
  3. See that file are not commited.

Expected behavior
I think the script should split $INPUT_FILE_PATTERN on spaces to get the different patterns in an array variable, then use quoting of arguments.

read -a INPUT_FILES <<< "$INPUT_FILE_PATTERN"
... (later on) ...
git status "${INPUT_FILES[@]}"
...
git add "${INPUT_FILES[@]}"

Used Workflow

See link above

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions