Skip to content

Commit de80102

Browse files
committed
Refactor HTML Empty Line Removal Step in github-actions-s3-publish.yml
- REMOVED: The previous shell command using sed to delete empty lines from HTML files. - ADDED: A Python script that reads each HTML file, filters out empty lines, and writes the cleaned content back, enhancing cross-platform compatibility and maintainability. Signed-off-by: Leonid Petrov <lenia.petrov@gmail.com>
1 parent b4e1958 commit de80102

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/github-actions-s3-publish.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ jobs:
1515
uses: jerryjvl/jekyll-build-action@v1
1616

1717
- name: Remove empty lines from HTML
18-
run: find _site -name "*.html" -type f -exec sed -i '/^[[:space:]]*$/d' {} +
18+
run: |
19+
find _site -name "*.html" -type f -exec python3 -c "
20+
import sys
21+
with open(sys.argv[1], 'r') as f:
22+
lines = [line for line in f if line.strip()]
23+
with open(sys.argv[1], 'w') as f:
24+
f.writelines(lines)
25+
" {} \;
26+
1927
2028
- name: Configure AWS credentials
2129
uses: aws-actions/configure-aws-credentials@v1

0 commit comments

Comments
 (0)