diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1f28c28 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:alpine + +RUN apk add git make + +RUN go get github.com/gojp/goreportcard && \ + go get github.com/gojp/goreportcard/cmd/goreportcard-cli && \ + cd $GOPATH/src/github.com/gojp/goreportcard && make install + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index c4d93f9..073a443 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,19 @@ # go-report-card-action -Github action calling goreportcard-cli and refresh your card + +Github action calling goreportcard-cli and refresh your card on https://goreportcard.com + +## Inputs + +### `threshold` + +**Required** Threshold of failure command. Default `75`. + +## Example usage + +uses: actions/go-report-card-action@v1 +with: + threshold: '100' + +## Note + +inspired by https://github.com/creekorful/goreportcard-action diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..6d690b2 --- /dev/null +++ b/action.yaml @@ -0,0 +1,15 @@ +name: 'Go Report Card' +description: 'Run goreportcard-cli and update project Go report card on https://goreportcard.com' +branding: + icon: 'check-circle' + color: 'green' +inputs: + threshold: + description: 'Threshold of failure command' + required: true + default: '75' +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.threshold }} diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..38adbcf --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -xe + +goreportcard-cli -v -t $1 +curl -X POST -F "repo=github.com/$GITHUB_REPOSITORY" https://goreportcard.com/checks