Skip to content
/ lfs-warning Public template
forked from ppremk/lfs-warning

GitHub Action to detect Large Files in a Pull Request

License

Notifications You must be signed in to change notification settings

StilleQuelle308/lfs-warning

 
 

Repository files navigation

LFS-Warning action

This action works to prevent both:

  • Large files that are not LFS tracked
  • Files that are LFS tracked
  • Files that match a binary file extension pattern and are not LFS tracked (optional)

from being checked-in in non-pointer format/not stored in LFS. The latter happens if the client does not have git-lfs installed.

How it works

This action scans files in commits of a pull request and will mark the pull request as failed, add a lfs-detected! label and reply with an issue comment if any of the following is true about any of the pull request files:

  • The file size is greater than the configured file size limit threshold.
  • The file is tracked in LFS but is being checked-in as a regular file
    • the current implementation of this check is that the file has git attribute filter: lfs but does not contain the string version https://git-lfs.github.com/spec/v1

pr-with-lfs-detected

Note: Remember to configure the branch protection rule and select the LFS-warning status when you enable the Required status check to pass option.

status-check

Inputs

filesizelimit

Optional. set's the file size limit threshold. Accepts b (bytes), kb (kilobytes), mb (megabytes) and gb (gigabytes) as units of measurement, if omitted interprets as bytes.

Default 10mb.

token

Optional. Takes a valid GitHub Token from the Repo by default.

exclusionPatterns

Optional. A newline delimited list of glob patterns that match checked in files to exclude form LFS Warning.

inclusionPatterns

Optional. A newline delimited list of glob patterns that will include matching files, even if the file size does not exceed the specified limit or they are not considered binary.

labelName

Optional. The name of the label, defaults to lfs-detected!

labelColor

Optional. The color of the label, defaults to ff1493.

Outputs

lfsFiles

Returns an array of possible detected large file(s)

Usage

Consume the action by referencing the stable release

uses: actionsdesk/[email protected]
with:
  token: ${{ secrets.GITHUB_TOKEN }} # Optional
  with:
    filesizelimit: 10MB
    exclusionPatterns: |
      **/*.png

Contributers

About

GitHub Action to detect Large Files in a Pull Request

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.3%
  • JavaScript 0.7%