Skip to content

Commit

Permalink
Merge pull request #1 from golangci/action-update
Browse files Browse the repository at this point in the history
Action update
  • Loading branch information
ernado committed Apr 26, 2020
2 parents bae0e14 + 832a5f0 commit 7a50c22
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Image CI
name: docker image

on: [push]

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/golangci.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
FROM golangci/golangci-lint:v1.25

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# golangci-lint-action

Work in progress

Based on [reviewdog action](https://github.com/reviewdog/action-golangci-lint).
13 changes: 13 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ inputs:
github_token:
description: 'GITHUB_TOKEN'
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:
using: 'docker'
image: 'Dockerfile'
Expand Down
9 changes: 8 additions & 1 deletion entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions sample/sample.go
Original file line number Diff line number Diff line change
@@ -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))
}

0 comments on commit 7a50c22

Please sign in to comment.