Compare commits

...

19 Commits

Author SHA1 Message Date
666cc9164e use golangci-lint v1.26 2020-05-03 16:06:24 +03:00
24c25982ec all: remove github token from readme 2020-04-26 19:51:36 +03:00
85e31a269e Merge pull request #2 from golangci/release-04-26
Update readme and action
2020-04-26 19:45:07 +03:00
9c543591de workflow: remove github token 2020-04-26 19:43:53 +03:00
4cb8a13e45 action: make github token optional 2020-04-26 19:41:24 +03:00
67503c7b3d readme: improve 2020-04-26 19:40:37 +03:00
7a50c22d12 Merge pull request #1 from golangci/action-update
Action update
2020-04-26 04:51:18 +03:00
832a5f00c9 entrypoint: fix input args 2020-04-26 04:50:20 +03:00
d3ea46b6e2 add format 2020-04-26 04:39:27 +03:00
542ddbcf10 use exit code 0 2020-04-26 04:31:18 +03:00
04ae938712 rename docker image step 2020-04-26 04:27:08 +03:00
48933044a0 use directory arg 2020-04-26 04:23:27 +03:00
c29c0c454f add directory arg 2020-04-26 04:22:56 +03:00
4cfaabcf34 chmod 2020-04-26 04:01:57 +03:00
2a6877729d echo start 2020-04-26 03:58:43 +03:00
bdb0c2099d short naming 2020-04-26 03:55:56 +03:00
4787970861 add entrypoint 2020-04-26 03:54:00 +03:00
6eb54d49f7 add sample 2020-04-26 03:52:07 +03:00
60b57697f8 mention reviewdog 2020-04-26 03:45:08 +03:00
7 changed files with 76 additions and 5 deletions

View File

@ -1,4 +1,4 @@
name: Docker Image CI
name: docker image
on: [push]

14
.github/workflows/golangci.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: golangci
on: [pull_request]
jobs:
golangci-lint-dockerfile:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: ./
with:
directory: sample
format: colored-line-number
flags: --issues-exit-code 0

View File

@ -1 +1,5 @@
FROM golangci/golangci-lint:v1.25
FROM golangci/golangci-lint:v1.26
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,3 +1,22 @@
# golangci-lint-action
Work in progress
![docker image](https://github.com/golangci/golangci-lint-action/workflows/docker%20image/badge.svg)
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
```
Based on [reviewdog action](https://github.com/reviewdog/action-golangci-lint).

View File

@ -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
View 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
View 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))
}