Glob markdown files on github action only returns `docs` folder

I have multiple folders in my project containing markdown files. I want to run cspell (and other tools) against them. Unfortunately, only the markdown files in the docs subfolder are returned in the blob.

Here’s a snippet of an actions file:

      - name: 'Spellchecking Content'
        run: |
          npm install cspell -g
          pwd
          ls ./**/*.md
          npx cspell $(ls ./**/*.md) -c ${{ github.workspace }}/cspell.json
        working-directory: ${{ github.workspace }}

Again, the problem is that the ls ./**/*.md in GitHub actions only returns the markdown files in the docs folder and no markdown files in the other subfolders.

Troubleshooting:

  • pwd prints the correct, home folder of the project workspace
  • ls ./**/*.md only lists the files in the docs subfolder
  • I’ve attempted to set the working-directory explicitly
  • The command works on my local machine, just not on GitHub

So, interestingly enough, if I replace

npx cspell $(ls ./**/*.md) -c ${{ github.workspace }}/cspell.json

with

npx cspell $(find . -name '*.md') -c ${{ github.workspace }}/cspell.json

it works.

Is this a bug or documented limitation in GitHub actions?

It seems the bash in github actions has different defaults like your system,
You might need to add shopt -s globstar to your script before ls ./**/*.md to enable the globstar.
E.g.

      - name: 'Spellchecking Content'
        run: |
          shopt -s globstar
          npm install cspell -g
          pwd
          ls ./**/*.md
          npx cspell $(ls ./**/*.md) -c ${{ github.workspace }}/cspell.json
        working-directory: ${{ github.workspace }}

See here for more information:

that works. thanks.

I also found that the find command is a suitable alternative too.

thanks again!