Skip to content
A GitHub Action to run Go commands
Shell Go Makefile Dockerfile
Branch: master
Clone or download
Pull request Compare This branch is even with cedrickring:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.dockerfile_lint
.github
build
go1.10
go1.11
go1.12
tests/projects
.gitignore
Dockerfile
LICENSE
Makefile
README.md
docker.mk
entrypoint.sh
help.mk
shell.mk

README.md

Actions Status

Golang Action

This Action allows you to run Go commands with your code. It will automatically setup your workspace (~/go/src/github.com/<your-name>/<repo>) before the command is run.

How to use

Create a workflow.yaml file in .github/workflows with the following contents:

on: push
name: My cool Action
job:
  checks:
    name: run
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master

    - name: run
      uses: cedrickring/golang-action@1.3.0

If no args are specified and a Makefile is detected, this action will run make. Otherwise go test and go build will be run. To run a custom command, just use:

steps:
- name: Run custom command
  uses: cedrickring/golang-action@1.3.0
  with:
    args: make my-target

If your repository's import name is different from the path on GitHub, provide the import name by adding an environment variable IMPORT=import/name. This may be useful if you have forked an open source Go project:

steps:
- name: Run with custom import path
  uses: cedrickring/golang-action@1.3.0
  env:
    IMPORT: "root/repo"

To use Go Modules add GO111MODULE=on to the step:

steps:
- name: Go Modules
  uses: cedrickring/golang-action@1.3.0
  env:
    GO111MODULE: "on"

If your go project is not located at the root of the repo you can also specify environment variable PROJECT_PATH:

steps:
- name: Custom project path
  uses: cedrickring/golang-action@1.3.0
  env:
    PROJECT_PATH: "./path/in/my/project"

To use a specific golang version (1.10, 1.11, 1.12):

steps:
- name: Use Go 1.11
  uses: cedrickring/golang-action/go1.11@1.3.0
You can’t perform that action at this time.