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 34b7d52
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:

Check failure on line 12 in .github/workflows/knative-lazyload-check.yaml

View workflow job for this annotation

GitHub Actions / style / suggester / github_actions

[actionlint] reported by reviewdog 🐶 could not parse as YAML: yaml: line 12: did not find expected '-' indicator [syntax-check] Raw Output: .github/workflows/knative-lazyload-check.yaml:12:0: could not parse as YAML: yaml: line 12: did not find expected '-' indicator [syntax-check]
- 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 34b7d52

Please sign in to comment.