Skip to content

Commit 7a50c22

Browse files
authored
Merge pull request #1 from golangci/action-update
Action update
2 parents bae0e14 + 832a5f0 commit 7a50c22

File tree

7 files changed

+58
-2
lines changed

7 files changed

+58
-2
lines changed

.github/workflows/dockerimage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docker Image CI
1+
name: docker image
22

33
on: [push]
44

.github/workflows/golangci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: golangci
2+
on: [pull_request]
3+
jobs:
4+
golangci-lint-dockerfile:
5+
name: lint
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Check out code into the Go module directory
9+
uses: actions/checkout@v1
10+
- name: golangci-lint
11+
uses: ./
12+
with:
13+
github_token: ${{ secrets.github_token }}
14+
directory: sample
15+
format: colored-line-number
16+
flags: --issues-exit-code 0

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
FROM golangci/golangci-lint:v1.25
2+
3+
COPY entrypoint.sh /entrypoint.sh
4+
5+
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# golangci-lint-action
22

33
Work in progress
4+
5+
Based on [reviewdog action](https://github.com/reviewdog/action-golangci-lint).

action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ inputs:
66
github_token:
77
description: 'GITHUB_TOKEN'
88
required: true
9+
flags:
10+
description: 'GolangCI command line flags'
11+
required: false
12+
directory:
13+
description: 'Working directory'
14+
required: false
15+
default: ''
16+
format:
17+
description: 'Output format of issues'
18+
default: 'github-actions'
19+
required: false
20+
21+
922
runs:
1023
using: 'docker'
1124
image: 'Dockerfile'

entrypoint.sh

100644100755
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
#!/bin/bash
22

3-
golangci-lint run --out-format github-actions
3+
echo 'golangci-lint-action: start'
4+
echo " flags: ${INPUT_FLAGS}"
5+
echo " format: ${INPUT_FORMAT}"
6+
7+
cd "${GITHUB_WORKSPACE}/${INPUT_DIRECTORY}" || exit 1
8+
9+
# shellcheck disable=SC2086
10+
golangci-lint run --out-format ${INPUT_FORMAT} ${INPUT_FLAGS}

sample/sample.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Package sample is used as test input for golangci action.
2+
package sample
3+
4+
import (
5+
"crypto/md5"
6+
"encoding/hex"
7+
)
8+
9+
// Hash~
10+
func Hash(data string) string {
11+
h := md5.New()
12+
h.Write([]byte(data))
13+
return hex.EncodeToString(h.Sum(nil))
14+
}

0 commit comments

Comments
 (0)