Skip to content

Fix link-check crash from html module shadowing #1571

Fix link-check crash from html module shadowing

Fix link-check crash from html module shadowing #1571

Workflow file for this run

name: Check Images in PR
# =======================
# Image Validation Workflow
# =======================
# Purpose: Validates image files and references in pull requests
# Triggers: PR opened, synchronized, or reopened
# Checks: Image format, size, accessibility, and broken references
on:
pull_request:
types: [opened, synchronize, reopened]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
permissions:
contents: read
issues: write
pull-requests: write
jobs:
check-images:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyGithub
- name: Run Image Check Script
id: image_check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF: ${{ github.ref }}
run: |
python scripts/webp_conversion/check_images_in_pr.py
# Same-repo PRs: the token can write, so post/update the result as a PR comment.
- name: Find Comment
if: github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/find-comment@v4
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: mage files/references
- name: Create or update comment
if: github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.image_check.outputs.comment }}
edit-mode: replace
# Fork PRs: the GITHUB_TOKEN is read-only, so a PR comment would 403.
# Surface the same result as a job-summary report in the workflow run instead.
- name: Image check report (fork PR)
if: github.event.pull_request.head.repo.full_name != github.repository
env:
REPORT: ${{ steps.image_check.outputs.comment }}
run: |
{
echo "## 🖼️ Image check report"
echo ""
echo "> This PR is from a fork, so the workflow cannot post a PR comment"
echo "> (fork runs receive a read-only token). The result is shown below."
echo ""
echo "$REPORT"
} >> "$GITHUB_STEP_SUMMARY"