-
-
Notifications
You must be signed in to change notification settings - Fork 275
Description
Version of the Action
v4.9.2
Describe the bug
If INPUT_FILE_PATTERN contains a wildcard, the shell will attempt to expand it to the name(s) of matching files if they exist. This list of filenames will then be passed to git status and git add as part of _git_is_dirty() and _add_files(), instead of the originally specified string. The list of files (obtained from shell globbing) can differ from the list of files that would have matched using git pathspec.
To Reproduce
- Start with a repo with two files:
.
├── package
│ └── module.py
└── setup.py
- Modify package/module.py
- Run git-auto-commit-action with a file_pattern input of
"*.py". - See output message of "Working tree clean. Nothing to commit". This is because the shell expanded INPUT_FILE_PATTERN from "*.py" to "setup.py" before passing it to
git status. Because setup.py was not modified,git statuswill report no change.
Expected behavior
git status should report that package/module.py was modified. And then git add should add package/module.py.
Possible fix
Running set -o noglob in entrypoint.sh will turn off glob file expansion. This could probably be run at the top of the script, but could also be run in a more local, targeted fashion, so long as it covers both the call to git status and git add.