diff --git a/.ecrc b/.ecrc new file mode 100644 index 0000000..2bb627e --- /dev/null +++ b/.ecrc @@ -0,0 +1,18 @@ +{ + "Verbose": false, + "Debug": false, + "IgnoreDefaults": false, + "SpacesAftertabs": false, + "NoColor": false, + "exclude": ["testfiles"], + "AllowedContentTypes": [], + "PassedFiles": [], + "Disable": { + "EndOfLine": false, + "Indentation": false, + "InsertFinalNewline": false, + "TrimTrailingWhitespace": false, + "IndentSize": false, + "MaxLineLength": false + } +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..38880be --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +charset = utf-8 +end_of_line = crlf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +curly_bracket_next_line = false +spaces_around_operators = false +spaces_around_brackets = both + +[*.md] +trim_trailing_whitespace = false +indent_size = 2 + +[*{.yml,.ecrc,.nix}] +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/README.md b/README.md new file mode 100644 index 0000000..d14be96 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# setup-editorconfig-checker + +This action downloads [editorconfig-checker](https://github.com/editorconfig-checker/editorconfig-checker) by version number and adds it to your path, enabling you to check if your files consider your .editorconfig-rules, regardless of filetype. + +# Usage + +See [action.yml](action.yml) + +Basic: + +```yaml +steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install editorconfig-checker + - uses: kasperhesthaven/editorconfig-checker@v1 + with: + version: "2.1.0" # Defaults to latest if not set + + - name: Lint + - run: editorconfig-checker +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..7b6518d --- /dev/null +++ b/action.yml @@ -0,0 +1,41 @@ +name: "Setup editorconfig-checker" +description: "Downloads the editorconfig-checker binary by version number and adds it to your PATH" +author: "Kasper Hesthaven" +branding: + icon: play + color: green +inputs: + version: + description: "Version to download, e.g., 2.1.0 or 2.0.4. (default: latest)" + required: false + command-name: + description: "Set editorconfig-checker command name, e.g., 'ec'. (default: editorconfig-checker)" + required: false + default: "editorconfig-checker" +runs: + using: "composite" + steps: + - name: Assign latest version if version not provided + run: | + if [ -z ${{ inputs.version }} ]; then + echo "::set-env name=VERSION::$(curl --silent "https://api.github.com/repos/editorconfig-checker/editorconfig-checker/releases/latest" | jq -r .tag_name)" + else + echo "::set-env name=VERSION::${{ inputs.version }}" + fi + shell: bash + + - name: Assign lowercase runner env + run: | + echo "::set-env name=OS::$(uname -s | tr '[:upper:]' '[:lower:]')" + echo "::set-env name=ARCH::amd64" + shell: bash + + - name: Download & add to path as editorconfig-checker + run: | + mkdir /home/runner/editorconfig-checker & cd "$_" + echo "Downloading editorconfig-checker version $VERSION for $OS-$ARCH from https://github.com/editorconfig-checker/editorconfig-checker/releases/download/$VERSION/ec-$OS-$ARCH.tar.gz" + curl -L https://github.com/editorconfig-checker/editorconfig-checker/releases/download/$VERSION/ec-$OS-$ARCH.tar.gz | tar zx --strip-components 1 + mv ec-$OS-$ARCH ${{ inputs.command-name }} + echo "Adding editorconfig-checker to path as ${{ inputs.command-name }}" + echo "::add-path::$(pwd)" + shell: bash