Skip to content

Commit

Permalink
add check name option
Browse files Browse the repository at this point in the history
  • Loading branch information
morphy2k committed Dec 6, 2020
1 parent 80b4905 commit 7829a37
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
35 changes: 19 additions & 16 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
name: 'Revive Action'
description: 'Lint your Go code with Revive'
author: 'Markus Wiegand'
name: "Revive Action"
description: "Lint your Go code with Revive"
author: "Markus Wiegand"
branding:
icon: 'code'
color: 'blue'
icon: "code"
color: "blue"
inputs:
config:
description: 'Path of the Revive config file'
required: false
exclude:
description: 'Revive exclude patterns, separated by semicolons'
required: false
path:
description: 'Revive path pattern'
required: false
config:
description: "Path of the Revive config file"
required: false
exclude:
description: "Revive exclude patterns, separated by semicolons"
required: false
path:
description: "Revive path pattern"
required: false
name:
description: "Display name of the check"
required: false
runs:
using: 'docker'
image: 'Dockerfile'
using: "docker"
image: "Dockerfile"
4 changes: 4 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ set -e

cd "$GITHUB_WORKSPACE"

CHECK_NAME="revive-action"

if [ ! -z "${INPUT_NAME}" ]; then CHECK_NAME=$INPUT_NAME; fi

LINT_PATH="./..."

if [ ! -z "${INPUT_PATH}" ]; then LINT_PATH=$INPUT_PATH; fi
Expand Down
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import (
"golang.org/x/oauth2"
)

const name = "Revive Action"

const (
envName = "CHECK_NAME"
envRepo = "GITHUB_REPOSITORY"
envSHA = "GITHUB_SHA"
envToken = "GITHUB_TOKEN"
Expand All @@ -25,6 +24,7 @@ const (
)

var (
name string
ghToken string
repoOwner string
repoName string
Expand All @@ -34,6 +34,13 @@ var (
var client *github.Client

func init() {
if env := os.Getenv(envName); len(env) > 0 {
name = env
} else {
fmt.Fprintln(os.Stderr, "Missing environment variable:", envName)
os.Exit(2)
}

if env := os.Getenv(envToken); len(env) > 0 {
ghToken = env
} else {
Expand Down

0 comments on commit 7829a37

Please sign in to comment.