Skip to content

sjkaliski/go-github-actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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/fmt@v1.0.0"
  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/lint@v1.0.0"
  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.