Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
85e31a269e | |||
9c543591de | |||
4cb8a13e45 | |||
67503c7b3d | |||
7a50c22d12 | |||
832a5f00c9 | |||
d3ea46b6e2 | |||
542ddbcf10 | |||
04ae938712 | |||
48933044a0 | |||
c29c0c454f | |||
4cfaabcf34 | |||
2a6877729d | |||
bdb0c2099d | |||
4787970861 | |||
6eb54d49f7 | |||
60b57697f8 |
2
.github/workflows/dockerimage.yml
vendored
2
.github/workflows/dockerimage.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Docker Image CI
|
||||
name: docker image
|
||||
|
||||
on: [push]
|
||||
|
||||
|
15
.github/workflows/golangci.yml
vendored
Normal file
15
.github/workflows/golangci.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
name: golangci
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
golangci-lint-dockerfile:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v1
|
||||
- name: golangci-lint
|
||||
uses: ./
|
||||
with:
|
||||
directory: sample
|
||||
format: colored-line-number
|
||||
flags: --issues-exit-code 0
|
@ -1 +1,5 @@
|
||||
FROM golangci/golangci-lint:v1.25
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
24
README.md
24
README.md
@ -1,3 +1,25 @@
|
||||
# golangci-lint-action
|
||||
|
||||
Work in progress
|
||||

|
||||
|
||||
Action that runs [golangci-lint](https://github.com/golangci/golangci-lint) and reports issues from linters.
|
||||
|
||||
You can put `.github/workflows/lint.yml` with following contents:
|
||||
```yaml
|
||||
name: golangci
|
||||
on: [push]
|
||||
jobs:
|
||||
golangci:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v1
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v0.0.2
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
|
||||
```
|
||||
|
||||
Based on [reviewdog action](https://github.com/reviewdog/action-golangci-lint).
|
||||
|
15
action.yml
15
action.yml
@ -5,7 +5,20 @@ author: 'golangci'
|
||||
inputs:
|
||||
github_token:
|
||||
description: 'GITHUB_TOKEN'
|
||||
required: true
|
||||
required: false
|
||||
flags:
|
||||
description: 'GolangCI command line flags'
|
||||
required: false
|
||||
directory:
|
||||
description: 'Working directory'
|
||||
required: false
|
||||
default: ''
|
||||
format:
|
||||
description: 'Output format of issues'
|
||||
default: 'github-actions'
|
||||
required: false
|
||||
|
||||
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
|
9
entrypoint.sh
Normal file → Executable file
9
entrypoint.sh
Normal file → Executable file
@ -1,3 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
golangci-lint run --out-format github-actions
|
||||
echo 'golangci-lint-action: start'
|
||||
echo " flags: ${INPUT_FLAGS}"
|
||||
echo " format: ${INPUT_FORMAT}"
|
||||
|
||||
cd "${GITHUB_WORKSPACE}/${INPUT_DIRECTORY}" || exit 1
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
golangci-lint run --out-format ${INPUT_FORMAT} ${INPUT_FLAGS}
|
||||
|
14
sample/sample.go
Normal file
14
sample/sample.go
Normal file
@ -0,0 +1,14 @@
|
||||
// Package sample is used as test input for golangci action.
|
||||
package sample
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
// Hash~
|
||||
func Hash(data string) string {
|
||||
h := md5.New()
|
||||
h.Write([]byte(data))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
Reference in New Issue
Block a user