mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
skip empty files (#159)
This commit is contained in:
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@@ -36,10 +36,11 @@ jobs:
|
|||||||
artifact-*.txt
|
artifact-*.txt
|
||||||
README.md
|
README.md
|
||||||
|
|
||||||
- name: Add artifacts/artifact.txt
|
- name: Add artifacts/*.txt
|
||||||
run: |
|
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
|
||||||
|
touch artifacts/empty_file.txt
|
||||||
|
|
||||||
- name: Single in subdir
|
- name: Single in subdir
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
6
tip.py
6
tip.py
@@ -27,7 +27,11 @@ if len(args) == 0:
|
|||||||
for item in args:
|
for item in args:
|
||||||
items = [fname for fname in glob(item, recursive=True) if not Path(fname).is_dir()]
|
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
|
for fname in items:
|
||||||
|
if Path(fname).stat().st_size == 0:
|
||||||
|
print("! Skipping empty file %s" % fname)
|
||||||
|
continue
|
||||||
|
files += [fname]
|
||||||
|
|
||||||
if len(files) < 1:
|
if len(files) < 1:
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
|
|||||||
Reference in New Issue
Block a user