# garnercorp/build-actions architecture

> Architecture diagram of the GitHub repository garnercorp/build-actions, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/garnercorp/build-actions
- Repository: https://github.com/garnercorp/build-actions

## Overview

##### Project Type & Purpose
- Project Type: A library of modular GitHub Actions and workflows.
- Purpose: To provide a suite of automated tasks for building, testing, publishing images, managing versioning, and integration tasks (such as secret scanning, spelling checks, and notifications) as part of the CI/CD processes.

##### Analyzing the File Structure
- The .github directory contains configurations for actions and workflows – indicating that the project is tightly integrated with GitHub’s continuous integration system.
- There are numerous top-level directories each representing a different action: for example, “yarn”, “scala”, “deploy”, “image”, “release”, “scoverage”, “bump-version”, etc. These are separate functional components.
- Additional directories (e.g., “scripts”) provide auxiliary tooling/scripts that support the actions.
- The presence of workflow YAML files in .github/workflows shows how the actions are orchestrated into pipeline tasks (e.g., secret scanning, formatting with scalafmt, and spelling checks).

##### Key Components
a. GitHub Workflows & Triggers:
- Centralized orchestration (e.g., workflows such as detect-new-secrets.yml, scalafmt.yml, spelling.yml) that launch the individual actions.
- These workflows are the “command centers” that call each action.

b. Individual GitHub Actions:
- Each folder (like “yarn”, “scala”, “deploy”, “image”, “release”, “scoverage”, “bump-version”, “kind-logs”, “docker-logs”, “configure-google-docker”, “tag-images”, “copy-image”, “google-k8s-pull-secrets”, “notify-slack”) should be modeled as distinct components.

c. Supporting Scripts & Tools:
- The “scripts” directory contains command scripts that assist in tasks like Docker builds, reporting, or matching logs.
- These might be shown as helper modules/services that are invoked by some actions.

d. External Services & Dependencies:
- Integrations with external systems:
- Docker Registry (for image building and publishing)
- Google Kubernetes Services (via actions like google-k8s-pull-secrets and configure-google-docker)
- Slack (via notify-slack) for notifications.
- If there are any external linters, secret scanners, or language-specific compilers (like Scala), note them.

##### Architectural Patterns & Relationships
- The project follows a modular/microservice-like design within the CI/CD ecosystem:
- Each GitHub Action works as an independent module.
- They are orchestrated together via GitHub workflows, meaning there’s a clear separation of concerns.
- Dependencies flow from upstream actions (e.g., compiling/building with “scala” and “yarn”) to downstream actions (e.g., “release”, “deploy” and “image” actions).
- Directional flow: For example, a “build” component might trigger “version bump” and then trigger “deploy” workflows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% GitHub Workflows
    subgraph "GitHub Workflows"
        W1("detect-new-secrets"):::workflow
        W2("scalafmt"):::workflow
        W3("spelling"):::workflow
    end

    %% GitHub Actions - Quality Checks
    subgraph "GitHub Actions - Quality Checks"
        Q1("Secret Scanner"):::quality
        Q2("Spelling Check"):::quality
        Q3("Prettier (Code Formatting)"):::quality
    end

    %% GitHub Actions - Build
    subgraph "GitHub Actions - Build"
        B1("Yarn Build"):::build
        B2("Scala Build"):::build
    end

    %% GitHub Actions - Test & Version
    subgraph "GitHub Actions - Test & Version"
        TV1("Scoverage"):::test
        TV2("Bump Version"):::test
        TV3("Next Version"):::test
    end

    %% GitHub Actions - Image/Deploy
    subgraph "GitHub Actions - Image/Deploy"
        D1("Image Build/Publish"):::deploy
        D2("Deploy"):::deploy
        D3("Release"):::deploy
    end

    %% GitHub Actions - Logs & Monitoring
    subgraph "GitHub Actions - Logs"
        L1("Kind Logs"):::logs
        L2("Docker Logs"):::logs
    end

    %% GitHub Actions - Integration & Notifications
    subgraph "GitHub Actions - Integration"
        I1("Configure Google Docker"):::integration
        I2("Tag Images"):::integration
        I3("Copy Image"):::integration
        I4("Google K8s Pull Secrets"):::integration
        I5("Notify Slack"):::integration
    end

    %% Supporting Scripts
    subgraph "Supporting Scripts"
        S("Auxiliary Scripts"):::script
    end

    %% External Services
    subgraph "External Services"
        E1("Docker Registry"):::external
        E2("Google Kubernetes"):::external
        E3("Slack"):::external
    end

    %% Workflow triggers quality and build actions
    W1 --> Q1
    W2 --> Q3
    W3 --> Q2

    %% Quality Checks feed into Build
    Q1 --> B1
    Q2 --> B1
    Q3 --> B1

    %% Supporting scripts assist Build actions
    B1 --> S
    B2 --> S

    %% Build actions: Yarn and Scala; connecting Yarn to Scala sequentially
    B1 --> B2

    %% Build triggers Test & Version stage
    B2 --> TV1
    B2 --> TV2
    B2 --> TV3

    %% Test & Version stage triggers Image Build/Publish
    TV1 --> D1
    TV2 --> D1
    TV3 --> D1

    %% Image Build/Publish publishes to Docker Registry
    D1 --> E1

    %% Image Build/Publish also triggers Deploy stage
    D1 --> D2

    %% Deploy triggers Release stage
    D2 --> D3

    %% Release triggers Integration steps
    D3 --> I1

    %% Integration chain: configuration, tagging, copying, pull secrets, then notifying
    I1 --> I2
    I2 --> I3
    I3 --> I4
    I4 --> I5

    %% Integration actions interact with external systems
    I1 --> E2
    I4 --> E2
    I5 --> E3

    %% Build actions also report logs
    B2 --> L1
    B2 --> L2

    %% Click Events
    click W1 "https://github.com/garnercorp/build-actions/blob/main/.github/workflows/detect-new-secrets.yml"
    click W2 "https://github.com/garnercorp/build-actions/blob/main/.github/workflows/scalafmt.yml"
    click W3 "https://github.com/garnercorp/build-actions/blob/main/.github/workflows/spelling.yml"
    click Q1 "https://github.com/garnercorp/build-actions/tree/main/.github/actions/secret-scanner"
    click Q2 "https://github.com/garnercorp/build-actions/tree/main/.github/actions/spelling"
    click Q3 "https://github.com/garnercorp/build-actions/blob/main/prettier/action.yml"
    click B1 "https://github.com/garnercorp/build-actions/blob/main/yarn/action.yml"
    click B2 "https://github.com/garnercorp/build-actions/blob/main/scala/action.yml"
    click TV1 "https://github.com/garnercorp/build-actions/blob/main/scoverage/action.yml"
    click TV2 "https://github.com/garnercorp/build-actions/blob/main/bump-version/action.yml"
    click TV3 "https://github.com/garnercorp/build-actions/blob/main/next-version/action.yml"
    click D1 "https://github.com/garnercorp/build-actions/blob/main/image/action.yml"
    click D2 "https://github.com/garnercorp/build-actions/blob/main/deploy/action.yml"
    click D3 "https://github.com/garnercorp/build-actions/blob/main/release/action.yml"
    click L1 "https://github.com/garnercorp/build-actions/blob/main/kind-logs/action.yml"
    click L2 "https://github.com/garnercorp/build-actions/blob/main/docker-logs/action.yml"
    click I1 "https://github.com/garnercorp/build-actions/blob/main/configure-google-docker/action.yml"
    click I2 "https://github.com/garnercorp/build-actions/blob/main/tag-images/action.yml"
    click I3 "https://github.com/garnercorp/build-actions/blob/main/copy-image/action.yml"
    click I4 "https://github.com/garnercorp/build-actions/blob/main/google-k8s-pull-secrets/action.yml"
    click I5 "https://github.com/garnercorp/build-actions/blob/main/notify-slack/workflow-status/action.yml"
    click S "https://github.com/garnercorp/build-actions/tree/main/scripts"

    %% Styles
    classDef workflow fill:#96ceb4,stroke:#03396c,stroke-width:2px;
    classDef quality fill:#ffcc5c,stroke:#d35d6e,stroke-width:2px;
    classDef build fill:#6b5b95,stroke:#feb236,stroke-width:2px;
    classDef test fill:#88d8b0,stroke:#05668d,stroke-width:2px;
    classDef deploy fill:#ff6f69,stroke:#8c4646,stroke-width:2px;
    classDef logs fill:#ffeead,stroke:#a8a8a8,stroke-width:2px;
    classDef integration fill:#7f5539,stroke:#d3b88c,stroke-width:2px;
    classDef script fill:#c6b497,stroke:#6b705c,stroke-width:2px;
    classDef external fill:#f4a261,stroke:#e76f51,stroke-width:2px;
```
