# stack-spot/stackspot-workflows-action architecture

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

- Interactive diagram: https://gitdiagram.com/stack-spot/stackspot-workflows-action
- Repository: https://github.com/stack-spot/stackspot-workflows-action

## Overview

##### Main Components

a) Core Components:
- Setup Action Module
- Repository Creation Actions
- Provider-specific Implementations
- Workflow Templates
- Helper Services

b) External Integration Points:
- SCM Providers (GitHub, GitLab, Azure DevOps, Bitbucket)
- StackSpot Workflow API
- StackSpot Portal

##### Component Relationships

Use the following connection types:

##### Specific Implementation Details

**[Setup Action Module]**
- Handles SCM setup
- Manages workflow configuration
- Processes hidden inputs

**[Repository Creation Actions]**
- Azure Implementation
- Bitbucket Implementation
- GitHub Implementation
- GitLab Implementation

**[Provider Clients]**
- Azure API Client
- Bitbucket API Client
- GitHub API Client
- GitLab API Client

**[Helper Services]**
- Git Helper
- HTTP Client
- STK Helper
- Utility Functions

##### Important Flows to Highlight

a) Repository Creation Flow:
**StackSpot Portal -> Setup Action -> Provider Client -> SCM Provider**
- > Write Context File -> Update Workflow Status

b) Workflow Template Management:
**Provider-specific Templates -> Workflow Setup -> SCM Integration**

##### Implementation Notes

- The modular nature of the provider implementations
- The separation of concerns between setup and creation actions
- The common helper services shared across providers
- The workflow template structure for each provider

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph External["External Systems"]
        direction TB
        SCM["SCM Providers"]
        Portal["StackSpot Portal"]
        API["StackSpot Workflow API"]
    end

    subgraph Core["Core Components"]
        direction TB
        Setup["Setup Action Module"]:::core
        click Setup "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/main.py"

        subgraph Providers["Provider Implementations"]
            direction TB
            Azure["Azure Provider"]:::provider
            Bitbucket["Bitbucket Provider"]:::provider
            GitHub["GitHub Provider"]:::provider
            GitLab["GitLab Provider"]:::provider

            click Azure "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/azure/azure_provider.py"
            click Bitbucket "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/bitbucket/bitbucket_provider.py"
            click GitHub "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/github/github_provider.py"
            click GitLab "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/gitlab/gitlab_provider.py"
        end

        subgraph APIClients["Provider API Clients"]
            direction TB
            AzureClient["Azure Client"]:::client
            BitbucketClient["Bitbucket Client"]:::client
            GitHubClient["GitHub Client"]:::client
            GitLabClient["GitLab Client"]:::client

            click AzureClient "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/azure/azure_api_client.py"
            click BitbucketClient "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/bitbucket/bitbucket_api_client.py"
            click GitHubClient "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/github/github_api_client.py"
            click GitLabClient "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/gitlab/gitlab_api_client.py"
        end

        subgraph RepoActions["Repository Creation Actions"]
            direction TB
            AzureAction["Azure Action"]:::action
            BitbucketAction["Bitbucket Action"]:::action
            GitHubAction["GitHub Action"]:::action
            GitLabAction["GitLab Action"]:::action

            click AzureAction "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/azure/create-repo-azure/script.py"
            click BitbucketAction "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/bitbucket/create-repo-bitbucket/script.py"
            click GitHubAction "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/github/create-repo-github/script.py"
            click GitLabAction "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/gitlab/script.py"
        end
    end

    subgraph Support["Support Services"]
        direction TB
        subgraph Helpers["Helper Services"]
            direction TB
            GitHelper["Git Helper"]:::helper
            HTTPClient["HTTP Client"]:::helper
            STKHelper["STK Helper"]:::helper
            Utils["Utility Functions"]:::helper

            click GitHelper "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/helpers/git_helper.py"
            click HTTPClient "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/helpers/http_client.py"
            click STKHelper "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/helpers/stk.py"
            click Utils "https://github.com/stack-spot/stackspot-workflows-action/blob/main/stackspot-actions/setup-stackspot-workflows/helpers/util.py"
        end

        subgraph Templates["Workflow Templates"]
            direction TB
            AzureTemp["Azure Template"]:::template
            BitbucketTemp["Bitbucket Template"]:::template
            GitHubTemp["GitHub Template"]:::template
            GitLabTemp["GitLab Template"]:::template

            click AzureTemp "https://github.com/stack-spot/stackspot-workflows-action/blob/main/workflow-templates/azure/middle-flow.yml"
            click BitbucketTemp "https://github.com/stack-spot/stackspot-workflows-action/blob/main/workflow-templates/bitbucket/bitbucket-pipelines.yml"
            click GitHubTemp "https://github.com/stack-spot/stackspot-workflows-action/blob/main/workflow-templates/github/.github/workflows/middle-flow.yml"
            click GitLabTemp "https://github.com/stack-spot/stackspot-workflows-action/blob/main/workflow-templates/gitlab/.gitlab-ci.yml"
        end
    end

    %% Connections
    Portal --> Setup
    Setup --> Providers
    Providers --> APIClients
    APIClients --> SCM
    Setup --> RepoActions
    RepoActions --> SCM
    Setup --> API
    Helpers --> Setup
    Templates --> Setup

    %% Provider-specific connections
    Azure --> AzureClient
    Bitbucket --> BitbucketClient
    GitHub --> GitHubClient
    GitLab --> GitLabClient

    %% Action-specific connections
    Azure --> AzureAction
    Bitbucket --> BitbucketAction
    GitHub --> GitHubAction
    GitLab --> GitLabAction

    %% Template connections
    Azure --> AzureTemp
    Bitbucket --> BitbucketTemp
    GitHub --> GitHubTemp
    GitLab --> GitLabTemp

    %% Styling
    classDef core fill:#2374ab
    classDef provider fill:#48a9a6
    classDef client fill:#4ea5d9
    classDef action fill:#44cfcb
    classDef helper fill:#e4dfda
    classDef template fill:#d4b483
```
