Skip to content

Commit

Permalink
ci: no more glob in workflow run
Browse files Browse the repository at this point in the history
  • Loading branch information
shirok1 committed Feb 26, 2025
1 parent 7787f8d commit 0434f80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: typst-community/setup-typst@v4
- run: python3 ci/mode_switch.py dev templates\*.typ
- run: python3 ci/mode_switch.py dev templates
- run: python3 ci/build.py
- uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 11 additions & 1 deletion ci/mode_switch.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#!/usr/bin/env python3

import os
import glob
import sys

line_to_comment = {"user": 1, "dev": 0}[sys.argv[1]]

for filename in sys.argv[2:]:
filenames = []

for path in sys.argv[2:]:
if os.path.isdir(path):
filenames.extend(glob.glob(os.path.join(path, "*.typ")))
else:
filenames.append(path)

for filename in filenames:
with open(filename) as f:
lines = f.readlines()
if len(lines) < 2:
Expand Down

0 comments on commit 0434f80

Please sign in to comment.