Skip to content

Action check fille size#75

Merged
stevenhwu merged 3 commits into
mainfrom
action-check-fille-size
Oct 30, 2025
Merged

Action check fille size#75
stevenhwu merged 3 commits into
mainfrom
action-check-fille-size

Conversation

@stevenhwu
Copy link
Copy Markdown
Owner

No description provided.

check and make sure no file is laregrthan 150kb in the `img` folder
Removed 'action-check-file-size' branch from workflow triggers.
@stevenhwu stevenhwu requested a review from Copilot October 30, 2025 16:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a GitHub Actions workflow to enforce a maximum file size limit of 150KB for images in the repository. The workflow runs on pushes and pull requests to the main branch, failing the build if any images exceed the specified threshold.

  • Introduces automated file size checking for the img directory
  • Provides clear error messages showing which files exceed the limit and their sizes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- name: Check for images larger than 150KB
run: |
MAX_SIZE="150k"
LARGE_FILES=$(find img -type f -size +$MAX_SIZE)
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The find command assumes the img directory exists. If the directory doesn't exist or is empty, the command will fail. Add -d flag or use a path check to handle this gracefully: find . -path ./img -prune -o -path ./img -type f -size +$MAX_SIZE -print or check if the directory exists first with [ -d img ] && ...

Suggested change
LARGE_FILES=$(find img -type f -size +$MAX_SIZE)
LARGE_FILES=$([ -d img ] && find img -type f -size +$MAX_SIZE)

Copilot uses AI. Check for mistakes.
- name: Check for images larger than 150KB
run: |
MAX_SIZE="150k"
LARGE_FILES=$(find img -type f -size +$MAX_SIZE)
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The workflow only checks files in the img directory but doesn't filter by file type. Consider adding file extension filtering to specifically target image files (e.g., -name '*.jpg' -o -name '*.png' -o -name '*.gif' -o -name '*.jpeg') to avoid false positives from non-image files.

Suggested change
LARGE_FILES=$(find img -type f -size +$MAX_SIZE)
LARGE_FILES=$(find img -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.gif' \) -size +$MAX_SIZE)

Copilot uses AI. Check for mistakes.
@stevenhwu stevenhwu merged commit 3cb456f into main Oct 30, 2025
7 checks passed
@stevenhwu stevenhwu deleted the action-check-fille-size branch October 30, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants