Skip to content

Commit

Permalink
Create golint GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome1337 committed Apr 13, 2020
1 parent e1b62dd commit a045ccd
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 2 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Jerome1337
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM cytopia/golint

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# golint-action
Ready to use go lint GitHub action
# Golint action

This action execute golint command and return the output if the command fail.

## Inputs

### `golint-path`

Path used by golint command, default is `./...`.

## Outputs

### `golint-output`

The golint output if the command fail.

## Example usage

```yaml
uses: Jerome1337/go-action/lint@v1.0.0
with:
golint-path: './src/...'
````
19 changes: 19 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Go-linter'
author: 'Jérôme Pogeant'
description: 'Lint your code using golint'
inputs:
golint-path:
description: 'Path used by golint command'
required: false
default: './...'
outputs:
golint-output:
description: 'The golint output if the command fail'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.golint-path }}
branding:
icon: 'check-circle'
color: 'green'
13 changes: 13 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh -l

cd $GITHUB_WORKSPACE

GOLINT_OUTPUT="$(golint -set_exit_status $1)"

if [ $? -ne 0 ]; then
echo "${GOLINT_OUTPUT}"

exit 1
fi

echo "::set-output name=golint-output::Golint step succeed"

0 comments on commit a045ccd

Please sign in to comment.