-
Notifications
You must be signed in to change notification settings - Fork 196
GitHub Action Check Extension Case
Chloe Lin [SSW] edited this page Jun 10, 2025
·
1 revision
This GitHub Action enforces a simple but important rule: image file extensions must be lowercase (e.g. .png, not .PNG). It runs automatically on pull requests to the main branch and will fail the workflow if any uppercase extensions are detected.
- On every pull request targeting the
mainbranch
- Checks out the pull request branch
-
Finds added files
Detect which files were added in the pull request -
Runs the extension check
The custom shell script loops through all added files and:- Extracts their file extension
- Strips unwanted characters
- Converts the extension to lowercase for comparison
- If the file is an image (
.png,.jpg,.jpeg,.gif,.svg,.webp) and has an uppercase extension, the script fails the job with an error: Error: Use lowercase file extensions
If someone adds example.JPG to a PR, this action will detect:
- It’s an image
- Its extension
.JPGis uppercase - The job will fail with:
- How to Create Rules
- How to Edit Rules
- How to Rename Rules
- How to Add and Edit Categories and Top Categories
- How to Rename Categories
- Creating your Fork (One time setup)
- Merging Your Fork
- Updating your fork
- Using Markdown
- Editing MDX Components (in GitHub)