Hi Friends - we have this issue that has been open for some time. it relates to running html proofer only on the files that already exist online. Right now if we create a new page in our website, guides, etc html proofer fails the build because it can’t find the link online (hence it’s a broken link). but really its just a link that doesn’t exist YET.
if anyone has time to help with this issue i’d greatly appreciate it. there are instructions for implementing it in the htmlproofer docs. but I haven’t had time to figure out how to implement it.
and i did ask chatGPT and it provided this solution which looks like it might work but i an worried it will still fail because it’s running HTML proofer first before identifying new pages and running it again (i think??)
if anyone has time to help us with this i’d greatly appreciate it!!
- name: Check HTML using htmlproofer
id: htmlproofer
uses: chabad360/htmlproofer@master
with:
directory: "_site"
arguments: |
--external_only
--ignore-urls "https://fonts.googleapis.com,https://fonts.gstatic.com,_site/_posts/README/index.html"
--ignore-files "/.+\/_posts\/README.md"
--ignore-status-codes "403, 503, 999"
- name: Skip HTMLProofer for new pages
run: |
for file in $(git diff --name-only HEAD~1 HEAD | grep '^_site/.*\.html$'); do
url=$(echo $file | sed 's/_site\(.*\)\.html/\1/')
echo "Skipping HTMLProofer check for new page: $url"
sed -i "/$url/d" $GITHUB_WORKSPACE/$id/htmlproofer_args.txt
done
env:
id: htmlproofer
- name: Re-run HTMLProofer after skipping new pages
run: |
cat $GITHUB_WORKSPACE/$id/htmlproofer_args.txt | xargs -0 chabad360/htmlproofer@master
env:
id: htmlproofer