Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/scripts/pr_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"uv.lock",
"*.lock",
"*.generated.*",
"images/*",
]

XL_COMMENT_MARKER = "<!-- pr-size-labeler:xl-warning -->"
Expand All @@ -58,7 +57,10 @@


def is_excluded(filename: str) -> bool:
"""Check if a file matches any exclusion pattern."""
"""Check if a file matches any exclusion pattern or is inside an images/ directory."""
# Check path-component match for images directories at any depth
if "/images/" in f"/{filename}":
return True
for pattern in EXCLUDED_PATTERNS:
if fnmatch.fnmatch(filename, pattern):
return True
Expand All @@ -77,7 +79,9 @@ def ensure_label_exists(repo, label_name: str) -> None:
"""Create the label in the repo if it doesn't exist."""
try:
repo.get_label(label_name)
except GithubException:
except GithubException as exc:
if exc.status != 404:
raise
color = LABEL_COLORS.get(label_name, "ededed")
repo.create_label(name=label_name, color=color)
print(f"Created label: {label_name}")
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,18 @@ jobs:
python-version: "3.12"

- name: Install dependencies
run: pip install PyGithub
run: pip install PyGithub==2.9.1

- name: Apply size labels
id: size_labels
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: python .github/scripts/pr_size.py

- name: Warn if size labeling failed
if: steps.size_labels.outcome == 'failure'
run: |
echo "::warning::Size labeling failed; area labels were applied but size labels may be stale or missing."
Loading