commit
7a50c22d12
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]
|
on: [push]
|
||||||
|
|
||||||
|
16
.github/workflows/golangci.yml
vendored
Normal file
16
.github/workflows/golangci.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
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:
|
||||||
|
github_token: ${{ secrets.github_token }}
|
||||||
|
directory: sample
|
||||||
|
format: colored-line-number
|
||||||
|
flags: --issues-exit-code 0
|
@ -1 +1,5 @@
|
|||||||
FROM golangci/golangci-lint:v1.25
|
FROM golangci/golangci-lint:v1.25
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
# golangci-lint-action
|
# golangci-lint-action
|
||||||
|
|
||||||
Work in progress
|
Work in progress
|
||||||
|
|
||||||
|
Based on [reviewdog action](https://github.com/reviewdog/action-golangci-lint).
|
||||||
|
13
action.yml
13
action.yml
@ -6,6 +6,19 @@ inputs:
|
|||||||
github_token:
|
github_token:
|
||||||
description: 'GITHUB_TOKEN'
|
description: 'GITHUB_TOKEN'
|
||||||
required: true
|
required: true
|
||||||
|
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:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
|
9
entrypoint.sh
Normal file → Executable file
9
entrypoint.sh
Normal file → Executable file
@ -1,3 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/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))
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user