A GitHub Action to fail builds whos files have both upper and lower case mixed, i.e. camelCase to prevent filename conflicts and broken deployments.
- Suggests kebab-case fixes of problem filenames for quicker fixing
- No dependencies* - to avoid supply chain security issues.
- Ignores common mixed case files that usually won't "break" builds, e.g.
CONTRIBUTING.md
*Note: GitHub Actions Toolkit is still required for JavaScript based actions.
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 }}
Use the pr-comment
param to toggle whether you want suggested renames added to a pull request.
-
Path to scan for mixed case filenames. Will search subfolders too.
Default:.
-
If file name errors are found, suggested fixes are posted to the Pull Request.
Default:false
-
GitHub Action workflow token needed to add comments to pull requests.
Default:''
-
Array - list of files with mixed case and suggested renames in JSON.
-
Array - list of all files that were checked for mixed case names.
-
String - URL of the comment posted to Pull Request (if errors were found).
If a system is case sensitive, then README.md
and readme.md
can co-exist.
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.
System | Case Sensistive |
---|---|
Windows | false, but preserves case |
Mac (HFS+) | false, but preserves case |
Git | true |
Linux | true |
Not deploying? Still a problem for colleagues. If you're collaborating and someone checks in a file with mixed case, it can be a nightmare to resolve because you have to do it in 2 places - OS and git. And if people don't keep their branches up to date, the mixed files come back like a recurring nightware ๐ตโ๐ซ
If you check the output, the action will also make suggestions using the kebab-case naming convention, for example:
Original name | Suggested Name |
---|---|
Foo/Bar.md |
foo/bar.md |
Foo/UppercaseExtension.MD |
foo/uppercase-extension.md |
FooBar/cat.txt |
foobar/cat.txt |
Foo |
foo |
MIT