@@ -300,4 +300,135 @@ jobs:
300300 exit 1
301301 fi
302302
303- echo "✅ Multiple files test passed"
303+ echo "✅ Multiple files test passed"
304+
305+ test-glob-patterns :
306+ runs-on : ubuntu-latest
307+ name : Test glob pattern support
308+ steps :
309+ - name : Checkout
310+ uses : actions/checkout@v4
311+
312+ - name : Setup test environment
313+ run : |
314+ # Create test directory structure
315+ mkdir -p /tmp/glob-test/subdir
316+
317+ # Create test files with Python code
318+ cat > /tmp/glob-test/file1.md << 'EOF'
319+ # Test File 1
320+ ` ` ` python
321+ def test_function(x,y):
322+ return x+y
323+ ` ` `
324+ EOF
325+
326+ cat > /tmp/glob-test/subdir/file2.md << 'EOF'
327+ # Test File 2
328+ ` ` ` {code-cell} python
329+ def another_function(a,b):
330+ result=a+b
331+ return result
332+ ` ` `
333+ EOF
334+
335+ cat > /tmp/glob-test/not-markdown.txt << 'EOF'
336+ This is not a markdown file
337+ EOF
338+
339+ - name : Test action with glob pattern
340+ id : glob-test
341+ uses : .//.github/actions/code-style-checker
342+ with :
343+ files : ' /tmp/glob-test/**/*.md'
344+ commit-files : ' false' # Don't commit during tests
345+
346+ - name : Verify glob pattern results
347+ run : |
348+ echo "Files processed: ${{ steps.glob-test.outputs.files-processed }}"
349+ echo "Files changed: ${{ steps.glob-test.outputs.files-changed }}"
350+ echo "Blocks formatted: ${{ steps.glob-test.outputs.total-blocks-formatted }}"
351+ echo "Changes made: ${{ steps.glob-test.outputs.changes-made }}"
352+
353+ if [ "${{ steps.glob-test.outputs.files-processed }}" != "2" ]; then
354+ echo "❌ Expected 2 files processed but got ${{ steps.glob-test.outputs.files-processed }}"
355+ exit 1
356+ fi
357+
358+ if [ "${{ steps.glob-test.outputs.changes-made }}" != "true" ]; then
359+ echo "❌ Expected changes to be made but none were made"
360+ exit 1
361+ fi
362+
363+ if [ "${{ steps.glob-test.outputs.files-changed }}" != "2" ]; then
364+ echo "❌ Expected 2 files changed but got ${{ steps.glob-test.outputs.files-changed }}"
365+ exit 1
366+ fi
367+
368+ if [ "${{ steps.glob-test.outputs.total-blocks-formatted }}" != "2" ]; then
369+ echo "❌ Expected 2 blocks formatted but got ${{ steps.glob-test.outputs.total-blocks-formatted }}"
370+ exit 1
371+ fi
372+
373+ echo "✅ Glob pattern test passed"
374+
375+ test-mixed-input :
376+ runs-on : ubuntu-latest
377+ name : Test mixed glob patterns and explicit files
378+ steps :
379+ - name : Checkout
380+ uses : actions/checkout@v4
381+
382+ - name : Setup test environment
383+ run : |
384+ # Create test directory
385+ mkdir -p /tmp/mixed-test
386+
387+ # Create a test file with Python code
388+ cat > /tmp/mixed-test/glob-file.md << 'EOF'
389+ # Glob File
390+ ` ` ` python
391+ def glob_function(x,y):
392+ return x+y
393+ ` ` `
394+ EOF
395+
396+ # Use existing test file as explicit file
397+ cp test/code-style-checker/unformatted-code.md /tmp/explicit-file.md
398+
399+ - name : Test action with mixed input
400+ id : mixed-test
401+ uses : .//.github/actions/code-style-checker
402+ with :
403+ files : ' /tmp/mixed-test/*.md,/tmp/explicit-file.md'
404+ commit-files : ' false' # Don't commit during tests
405+
406+ - name : Verify mixed input results
407+ run : |
408+ echo "Files processed: ${{ steps.mixed-test.outputs.files-processed }}"
409+ echo "Files changed: ${{ steps.mixed-test.outputs.files-changed }}"
410+ echo "Blocks formatted: ${{ steps.mixed-test.outputs.total-blocks-formatted }}"
411+ echo "Changes made: ${{ steps.mixed-test.outputs.changes-made }}"
412+
413+ if [ "${{ steps.mixed-test.outputs.files-processed }}" != "2" ]; then
414+ echo "❌ Expected 2 files processed but got ${{ steps.mixed-test.outputs.files-processed }}"
415+ exit 1
416+ fi
417+
418+ if [ "${{ steps.mixed-test.outputs.changes-made }}" != "true" ]; then
419+ echo "❌ Expected changes to be made but none were made"
420+ exit 1
421+ fi
422+
423+ if [ "${{ steps.mixed-test.outputs.files-changed }}" != "2" ]; then
424+ echo "❌ Expected 2 files changed but got ${{ steps.mixed-test.outputs.files-changed }}"
425+ exit 1
426+ fi
427+
428+ # Should format 1 block from glob file + at least 4 from explicit file
429+ if [ "${{ steps.mixed-test.outputs.total-blocks-formatted }}" -lt "5" ]; then
430+ echo "❌ Expected at least 5 blocks formatted but got ${{ steps.mixed-test.outputs.total-blocks-formatted }}"
431+ exit 1
432+ fi
433+
434+ echo "✅ Mixed input test passed"
0 commit comments