From 78b4cbe021c79c19f85c7fb1d395c89cd85e1aeb Mon Sep 17 00:00:00 2001 From: rlespinasse Date: Sat, 25 Apr 2020 22:03:46 +0200 Subject: [PATCH] style: add editorconfig file --- .editorconfig | 11 +++++++++++ LICENSE | 2 +- action.yml | 12 ++++++------ entrypoint.sh | 14 +++++++------- package.json | 2 +- tests/short_sha.bats | 2 +- tests/slug_ref.bats | 2 +- 7 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f136d0b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/LICENSE b/LICENSE index c5440e5..950f9e3 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 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. \ No newline at end of file +SOFTWARE. diff --git a/action.yml b/action.yml index b83dfd1..eaa8047 100644 --- a/action.yml +++ b/action.yml @@ -1,9 +1,9 @@ # action.yml -name: 'GitHub Slug' -description: 'Action to slug and expose some github variables' +name: "GitHub Slug" +description: "Action to slug and expose some github variables" runs: - using: 'docker' - image: 'Dockerfile' + using: "docker" + image: "Dockerfile" branding: - icon: 'crop' - color: 'orange' + icon: "crop" + color: "orange" diff --git a/entrypoint.sh b/entrypoint.sh index 0083292..3d5d021 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,15 +1,15 @@ #!/bin/sh -l slug_ref() { - echo "$1" \ - | tr "[:upper:]" "[:lower:]" \ - | sed -r 's#refs/[^\/]*/##;s/[~\^]+//g;s/[^a-zA-Z0-9]+/-/g;s/^-+\|-+$//g;s/^-*//;s/-*$//' \ - | cut -c1-63 + echo "$1" | + tr "[:upper:]" "[:lower:]" | + sed -r 's#refs/[^\/]*/##;s/[~\^]+//g;s/[^a-zA-Z0-9]+/-/g;s/^-+\|-+$//g;s/^-*//;s/-*$//' | + cut -c1-63 } -short_sha(){ - echo "$1" \ - | cut -c1-8 +short_sha() { + echo "$1" | + cut -c1-8 } echo ::set-env name=GITHUB_REF_SLUG::"$(slug_ref "$GITHUB_REF")" diff --git a/package.json b/package.json index 2f49750..5fa0cb3 100644 --- a/package.json +++ b/package.json @@ -33,4 +33,4 @@ "@semantic-release/github" ] } -} \ No newline at end of file +} diff --git a/tests/short_sha.bats b/tests/short_sha.bats index 97ef617..dd5d0f7 100644 --- a/tests/short_sha.bats +++ b/tests/short_sha.bats @@ -16,4 +16,4 @@ test_short_sha(){ actual="$(short_sha ${given})" echo "expected : [${expected}], actual : [${actual}]" [ "${actual}" == "${expected}" ] -} \ No newline at end of file +} diff --git a/tests/slug_ref.bats b/tests/slug_ref.bats index 00db998..89cdc1b 100644 --- a/tests/slug_ref.bats +++ b/tests/slug_ref.bats @@ -52,4 +52,4 @@ test_sluf_ref() { actual="$(slug_ref \"${given}\")" echo "expected : [${expected}], actual : [${actual}]" [ "${actual}" == "${expected}" ] -} \ No newline at end of file +}