Skip to content

globbing syntax is limited #51

@xxxserxxx

Description

@xxxserxxx

Version of the Action
v4.1.0

Describe the bug
Maybe this only requires a bit more documentation. However, it's not clear which syntax file_pattern uses, and under what conditions. Is it a bash glob? Or some other language? Why are the asterixes escaped? The bash syntax \{\*\*/PKGBUILD,\*\*/.SRCINFO\} does not work (escaped out so Workflows doesn't complain about the syntax), and neither does \*\*/PKGBUILD \*\*/.SRCINFO or any combination of syntax I've tried. Wrapping the glob in quotes, various permutations of escaping; I've tried several things.

Curiously, I can see globbing working, except it fails somehow when actually doing the git commit. In many cases, I get errors like:

INPUT_BRANCH value: 
M	aur-bin/.SRCINFO
M	aur-bin/PKGBUILD
M	aur/.SRCINFO
M	aur/PKGBUILD
Your branch is up to date with 'origin/master'.
INPUT_FILE_PATTERN: \{\*\*/PKGBUILD,\*\*/.SRCINFO\}
fatal: pathspec '\{\*\*/PKGBUILD,\*\*/.SRCINFO\}' did not match any files

so the log message is actually getting a proper glob list, but it fails in the actual message.

It'd be great to get some documentation about what is legal glob syntax, and maybe another example of non-trivial globbing. In my case, I'm looking for the result of the bash glob pattern:

{**/PKGBUILD,**/.SRCINFO}

To Reproduce
Make a project in github called globtest

mkdir -p dummy/A dummy/B dummy/.github/workflows/
pushd dummy
touch A/x A/y B/x B/y
cat > .github/workflows/dummy.yml <<EOL
name: dummy
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Get version
        shell: bash
        run: echo 1 > A/x ; echo 2 > A/y ; echo 3 > B/x ; echo 4 > B/y
      - uses: stefanzweifel/[email protected]
        with:
            commit_message: Message
            file_pattern: \{\*\*/x,\*\*/y\}
EOL
git init && git add . && git commit -m "X"
git remote add origin [email protected]:stefanzweifel/globtest.git
git push -f origin master
touch me && git commit -a -m "foo" && git push

Expected behavior
All changed files to be committed.

I didn't try any of that blob of steps above, so YMMV. But you get the idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions