From 6eb54d49f7828ee633453c0a441f202ff76fc0e8 Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Sun, 26 Apr 2020 03:51:07 +0300 Subject: [PATCH] add sample --- .github/workflows/golangci.yml | 14 ++++++++++++++ action.yml | 3 +++ sample/sample.go | 14 ++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 .github/workflows/golangci.yml create mode 100644 sample/sample.go diff --git a/.github/workflows/golangci.yml b/.github/workflows/golangci.yml new file mode 100644 index 0000000..1fe6094 --- /dev/null +++ b/.github/workflows/golangci.yml @@ -0,0 +1,14 @@ +name: golangci-lint +on: [pull_request] +jobs: + golangci-lint-dockerfile: + name: golangci-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 }} + flags: "./testdata" diff --git a/action.yml b/action.yml index 4762db3..7baf9ca 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,9 @@ inputs: github_token: description: 'GITHUB_TOKEN' required: true + flags: + description: 'GolangCI command line flags' + required: false runs: using: 'docker' image: 'Dockerfile' diff --git a/sample/sample.go b/sample/sample.go new file mode 100644 index 0000000..50071d0 --- /dev/null +++ b/sample/sample.go @@ -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)) +}