Skip to content

Commit

Permalink
added workflow file & removed build command from script
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamgupta2020 committed Jun 11, 2024
1 parent 4da7b8e commit 0b192e9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/knative-lazyload-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Image LazyLoad Check

on:
push:
branches:
- main

jobs:
run-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Set GITHUB_TOKEN environment variable
run: echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV

- name: Run Build
run: ./hack/docker/test.sh

- name: Run Python script
run: python check_img_lazy.py
12 changes: 0 additions & 12 deletions check_img_lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
import subprocess
from bs4 import BeautifulSoup

def build_website():
"""Build the website using the specified command."""
try:
subprocess.check_call(['./hack/docker/test.sh'])
except subprocess.CalledProcessError as e:
print(f"Website build failed: {e}")
sys.exit(1)

def check_img_tags(base_dir):
"""Recursively check HTML files for <img> tags without the lazy loading attribute."""
issues_found = False
Expand Down Expand Up @@ -46,9 +38,6 @@ def find_line_number(content, tag):

if __name__ == "__main__":

build_website()


base_dir = 'site'
issues_found = check_img_tags(base_dir)

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

0 comments on commit 0b192e9

Please sign in to comment.