Skip to content

Configuration

Customize Go Gamma Actions for your project's needs.

Go Version

Explicit Version

with:
  go-version: '1.24'

From go.mod

Automatically detect from your go.mod file:

with:
  go-version-file: 'go.mod'

YAML Parsing

Always quote version numbers! YAML parses 1.24 as 1.2 (float).

# ✅ Correct
go-version: '1.24'

# ❌ Wrong - parsed as 1.2
go-version: 1.24

Working Directory

For projects where Go code isn't in the root:

with:
  working-directory: './src'

For monorepos, see the Monorepo Guide.

Testing Options

Race Detection

Enabled by default. Disable for faster CI on trusted code:

with:
  race-detection: false

Test Flags

Add custom flags to go test:

with:
  test-flags: '-v -shuffle=on -count=1 -timeout=30m'

Coverage Upload

with:
  upload-coverage: true
secrets:
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Linting Options

Only New Issues

Report only issues introduced in the PR:

with:
  only-new-issues: ${{ github.event_name == 'pull_request' }}

Custom Configuration

Use your own .golangci.yml:

# In lint.yml usage
with:
  config-path: '.golangci.yml'

Linter Version

with:
  golangci-lint-version: 'v2'

Security Options

SARIF Upload

Upload results to GitHub Code Scanning:

permissions:
  security-events: write

with:
  upload-sarif: true

Fail on Vulnerabilities

with:
  fail-on-vulns: true   # Fail if vulns found (default)
  fail-on-vulns: false  # Warn only

Selective Scanning

with:
  run-gosec: true        # Run gosec
  run-govulncheck: true  # Run govulncheck

Build Options

Platforms

with:
  platforms: 'ubuntu-latest,macos-latest,windows-latest'

Single Platform

with:
  platforms: 'ubuntu-latest'

Upload Artifacts

with:
  upload-artifacts: true

Skip Phases

Skip Individual Phases

with:
  skip-lint: true      # Skip linting
  skip-security: true  # Skip security scan
  skip-build: true     # Skip build matrix

Use Cases

Scenario Configuration
Library (no binary) skip-build: true
Fast feedback skip-security: true
Draft PR skip-build: true, skip-security: true

Full Example

name: CI

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]

permissions:
  contents: read
  security-events: write

jobs:
  ci:
    uses: go-gamma/actions/.github/workflows/ci.yml@v1
    permissions:
      contents: read
      security-events: write
    with:
      # Go
      go-version: '1.24'
      working-directory: '.'

      # Testing
      race-detection: true
      upload-coverage: true

      # Linting
      only-new-issues: ${{ github.event_name == 'pull_request' }}

      # Security
      upload-sarif: true
      fail-on-vulns: true

      # Build
      platforms: 'ubuntu-latest,macos-latest,windows-latest'

    secrets:
      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Next Steps