Skip to content

Commit 34b7d52

Browse files
added workflow file & removed build command from script
1 parent 4da7b8e commit 34b7d52

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Image LazyLoad Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
run-tests:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.x'
20+
21+
- name: Set GITHUB_TOKEN environment variable
22+
run: echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
23+
24+
- name: Run Build
25+
run: ./hack/docker/test.sh
26+
27+
- name: Run Python script
28+
run: python check_img_lazy.py

check_img_lazy.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
import subprocess
44
from bs4 import BeautifulSoup
55

6-
def build_website():
7-
"""Build the website using the specified command."""
8-
try:
9-
subprocess.check_call(['./hack/docker/test.sh'])
10-
except subprocess.CalledProcessError as e:
11-
print(f"Website build failed: {e}")
12-
sys.exit(1)
13-
146
def check_img_tags(base_dir):
157
"""Recursively check HTML files for <img> tags without the lazy loading attribute."""
168
issues_found = False
@@ -46,9 +38,6 @@ def find_line_number(content, tag):
4638

4739
if __name__ == "__main__":
4840

49-
build_website()
50-
51-
5241
base_dir = 'site'
5342
issues_found = check_img_tags(base_dir)
5443

@@ -58,4 +47,3 @@ def find_line_number(content, tag):
5847
else:
5948
print("All img tags have lazy loading attribute.")
6049
sys.exit(0)
61-

0 commit comments

Comments
 (0)