GitHub Action - Lowercase Linter

A GitHub Action to fail builds with mixed case filenames, i.e. camelCase to prevent filename conflicts and broken deployments.

Install on GitHub  →

Problem

Because different operating systems handle case sensitivity differently,SETTINGS.JSON and settings.json can co-exist, which can lead to recurring git conflicts and even broken deployments.

Solution

This automated workflow aligns with Linux and git case sensitivity and encourages developers to stick with kebab-case, i.e. lowercase-with-dashes, which can be enforced in DevOps. The action will also suggest new filenames and paths to resolve the errors.

Linter Comment Preview
Linter Comment Preview

Features

  • Suggests kebab-case fixes of problem filenames for quicker fixing
  • No dependencie (other than required GitHub Actions Toolkit) - to avoid supply chain security issues.
  • Ignores common mixed case files that usually won't "break" builds, e.g. CONTRIBUTING.md

Example Usage

steps:
  - name: Checkout
    uses: actions/checkout@v2

  - name: Lint Filenames
    uses: julie-ng/lowercase-linter@v1
    id: lint_filenames
    continue-on-error: true
    with:
      path: '.'
      pr-comment: true
      repo-token: ${{ secrets.GITHUB_TOKEN }}

Reference

SystemCase Sensistive
Windowsfalse, but preserves case
Mac (HFS+)false, but preserves case
Gittrue
Linuxtrue

Example Problem

If a system is not case sensitive, then Logo.png can be referenced both as its actual mixed case name and all lowercase logo.png. So if you have <img src="logo.png"> but your image is actually named Logo.png, it will work locally but users will see a broken image when deployed to a Linux based server.


Date

2022

URL

github.com/julie-ng/lowercase-linter

Project Type

Tool

Skills

  • CI/CD
  • GitHub Actions

Tagged

  • Open Source
  • Productivity