style: add editorconfig file

This commit is contained in:
rlespinasse
2020-04-25 22:03:46 +02:00
parent 74fe20250f
commit 78b4cbe021
7 changed files with 28 additions and 17 deletions

11
.editorconfig Normal file
View File

@@ -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

View File

@@ -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"

View File

@@ -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")"