Skip to content

מעבר בין תצוגת טקסט ל-PDF מנווט לטאב הפתוח במקום לפתוח כפילות #1414

מעבר בין תצוגת טקסט ל-PDF מנווט לטאב הפתוח במקום לפתוח כפילות

מעבר בין תצוגת טקסט ל-PDF מנווט לטאב הפתוח במקום לפתוח כפילות #1414

Workflow file for this run

name: Goldens Guard
# תמונות הייחוס של test/goldens/ משתנות רק בשינוי ממשק מכוון
# (docs/design-system/CI_ENFORCEMENT.md §5.10, DD-23). PR שמוסיף, משנה או
# מוחק קובץ תחת test/goldens/ צריך את התווית goldens-approved, שמתחזק מוסיף
# אחרי שבדק את ה-diff. זה כולל את התמונות, וגם את קוד הבדיקות: ה־harness וסף
# ה־comparator, ‏skip ומחיקת בדיקה מחלישים את הבדיקה בלי לגעת בתמונה.
# golden שנכשל ב-PR שלא נגע בתמונות הוא רגרסיה.
on:
pull_request:
branches:
- main
- dev
types: [opened, synchronize, reopened, labeled, unlabeled]
permissions:
contents: read
pull-requests: read
concurrency:
group: goldens-guard-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
guard:
name: Golden image changes
runs-on: ubuntu-latest
steps:
- name: Check golden changes
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
APPROVED_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'goldens-approved') }}
run: |
set -euo pipefail
changed=$(gh api --paginate "repos/$REPO/pulls/$PR_NUMBER/files" \
--jq '.[] | select((.filename | startswith("test/goldens/")) or ((.previous_filename // "") | startswith("test/goldens/"))) | .status + " " + .filename')
if [ -z "$changed" ]; then
echo "Nothing under test/goldens/ changed."
exit 0
fi
images=$(echo "$changed" | { grep '\.png$' || true; })
code=$(echo "$changed" | { grep -v '\.png$' || true; })
if [ -n "$images" ]; then
echo "Changed golden images:"
echo "$images"
fi
if [ -n "$code" ]; then
echo "Changed golden test code (tests, skip, harness, comparator threshold):"
echo "$code"
fi
# ה־PR שמכניס את תשתית ה־golden: ב־base אין כלום תחת test/goldens/,
# וה־PR רק מוסיף. התמונות והבדיקות נבדקות בסקירה של ה־PR הזה עצמו.
base_count=$(gh api "repos/$REPO/git/trees/$BASE_SHA?recursive=1" \
--jq '[.tree[].path | select(startswith("test/goldens/"))] | length')
if [ "$base_count" = "0" ] && ! echo "$changed" | grep -qv '^added '; then
echo "The base has nothing under test/goldens/: this pull request introduces the golden tests."
exit 0
fi
if [ "$APPROVED_LABEL" = "true" ]; then
echo "Golden changes approved with the 'goldens-approved' label."
exit 0
fi
if [ -n "$images" ]; then
echo "::error::This pull request changes golden images under test/goldens/. Golden images change only with an intended UI change. A maintainer reviews the image diff and adds the 'goldens-approved' label."
fi
if [ -n "$code" ]; then
echo "::error::This pull request changes golden test code under test/goldens/ (a test, a skip, the harness or the comparator threshold). A maintainer reviews it and adds the 'goldens-approved' label."
fi
exit 1