set glob recursive=True

This commit is contained in:
eine
2020-10-10 17:31:04 +02:00
parent 4faf2667a2
commit 642b99b75d
2 changed files with 17 additions and 4 deletions

View File

@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: echo "Build some tool and generate some (versioned) artifacts" > artifact-$(date -u +"%Y-%m-%dT%H-%M-%SZ").txt - run: echo "Build some tool and generate some (versioned) artifacts" > artifact-$(date -u +"%Y-%m-%dT%H-%M-%SZ").txt
- name: Single - name: Single
@@ -36,7 +36,8 @@ jobs:
artifact-*.txt artifact-*.txt
README.md README.md
- run: | - name: Add artifacts/artifact.txt
run: |
mkdir artifacts mkdir artifacts
echo "Build some tool and generate some artifacts" > artifacts/artifact.txt echo "Build some tool and generate some artifacts" > artifacts/artifact.txt
@@ -46,7 +47,8 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
files: artifacts/artifact.txt files: artifacts/artifact.txt
- run: | - name: Add artifacts/*.md
run: |
echo "tip hello" > artifacts/hello.md echo "tip hello" > artifacts/hello.md
echo "tip world" > artifacts/world.md echo "tip world" > artifacts/world.md
@@ -55,3 +57,14 @@ jobs:
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
files: artifacts/* files: artifacts/*
- name: Add artifacts/subdir
run: |
mkdir artifacts/subdir
echo "Test recursive glob" > artifacts/subdir/deep_file.txt
- name: Directory wildcard (recursive)
uses: ./
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: artifacts/**

2
tip.py
View File

@@ -25,7 +25,7 @@ if len(args) == 0:
raise(Exception("Glob patterns need to be provided as positional arguments or through envvar 'INPUT_FILES'!")) raise(Exception("Glob patterns need to be provided as positional arguments or through envvar 'INPUT_FILES'!"))
for item in args: for item in args:
items = glob(item) items = [fname for fname in glob(item, recursive=True) if not Path(fname).is_dir()]
print("glob(%s)" % item, "->", items) print("glob(%s)" % item, "->", items)
files = files + items files = files + items