Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.24 KB

README.md

File metadata and controls

55 lines (40 loc) · 1.24 KB

go-github-actions

A collection of GitHub Actions for use in Golang projects.

Actions

Currently there is support for gofmt and golint. If triggered by a pull_request, any failure will be posted back to the PR as a comment.

gofmt

Runs gofmt on files in the directory. Fails if any file is not properly formatted.

workflow "Go" {
  on = "pull_request"
  resolves = ["gofmt"]
}

action "gofmt" {
  uses    = "sjkaliski/go-github-actions/[email protected]"
  needs   = "previous-action"
  secrets = ["GITHUB_TOKEN"]

  env {
    GO_WORKING_DIR = "./path/to/go/files"
    GO_IGNORE_DIRS = "./vendor"
  }
}

To learn more about gofmt, visit the official docs.

golint

Runs golint on files in the directory. Fails if any file fails lint checks.

workflow "Go" {
  on = "pull_request"
  resolves = ["golint"]
}

action "golint" {
  uses    = "sjkaliski/go-github-actions/[email protected]"
  needs   = "previous-action"
  secrets = ["GITHUB_TOKEN"]

  env {
    GO_WORKING_DIR = "./path/to/go/files"
    GO_LINT_PATHS  = "./pkg/... ./cmd/..."
  }
}

To learn more about golint, see the golint repository.