This GitHub Action allows you to enforce architectural rules in your Go projects using Goverhaul.
- Enforce architecture: Ensure your codebase adheres to the intended architecture
- CI/CD Integration: Seamlessly integrate architectural checks into your CI/CD pipeline
- No installation required: The action handles installing Goverhaul for you
- Customizable: Configure the action to match your project's specific needs
name: Architecture Check
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
goverhaul:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Goverhaul
uses: gophersatwork/goverhaul-action@main
with:
path: '.'
config: '.goverhaul.yml'
verbose: 'false'| Input | Description | Required | Default |
|---|---|---|---|
path |
Path to lint | No | . |
config |
Path to config file | No | .goverhaul.yml |
verbose |
Enable verbose logging for debugging | No | false |
Create a .goverhaul.yml file in your project root to define architectural rules. Example:
# Basic configuration for a typical layered architecture
rules:
# Domain layer should not depend on infrastructure
- path: "internal/domain"
prohibited:
- name: "internal/infrastructure"
cause: "Domain should not depend on infrastructure"
# API layer should not access database directly
- path: "internal/api"
prohibited:
- name: "internal/database"
cause: "API should access database through domain services"For more information on configuration options, see the Goverhaul documentation.
- name: Run Goverhaul
uses: gophersatwork/goverhaul-action@main
with:
path: './src'
config: './config/.goverhaul.yml'Make sure your configuration file exists at the path specified in the config input. If you're using a custom path, ensure it's relative to the repository root.
- name: Run Goverhaul
uses: gophersatwork/goverhaul-action@main
with:
config: '.goverhaul.yml' # This file must exist in your repositoryEnable verbose logging to get more information about what's happening:
- name: Run Goverhaul
uses: gophersatwork/goverhaul-action@main
with:
verbose: 'true' # Enable verbose logging