# ofirshtrull/action-webhook-slack-notify architecture

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

- Interactive diagram: https://gitdiagram.com/ofirshtrull/action-webhook-slack-notify
- Repository: https://github.com/ofirshtrull/action-webhook-slack-notify

## Overview

##### Project Type Analysis
This is a GitHub Action project that serves as an integration tool between GitHub's workflow system and Slack's messaging platform, with optional Hashicorp Vault integration for secret management.

##### Main Components

a. Core Components:
- GitHub Actions Runtime Environment
- The Action's Main Service (written in Go and Shell)
- Slack API Integration
- Optional Hashicorp Vault Integration

b. Data Flow Components:
- GitHub Workflow Event Triggers
- Environment Variables Processing
- Webhook Communication
- Secret Management

##### Input Layer
- GitHub Workflow Event (trigger)
- Environment Variables
- Secrets (SLACK_WEBHOOK or Vault credentials)

##### Processing Layer
- Action Runtime Container (shown as a bounded context)
- Main Go Application
- Shell Script Processor

##### External Services Layer
- Slack API
- Hashicorp Vault (optional component)

- Blue: GitHub components
- Green: Core action components
- Purple: External services
- Yellow: Security/secrets components

- Rectangles: Main components

##### Key Relationships to Highlight

- Event flow from GitHub workflow trigger to Slack message delivery
- Two possible paths for webhook URL retrieval:
a. Direct from GitHub Secrets
b. Through Hashicorp Vault

##### Implementation Details

- Environment variable processing
- Webhook message formatting
- Authentication flow
- Error handling paths

Create clear separations between:
##### External Services

**GitHub Event → Action Processing → External Service Communication → Slack Message Delivery**

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef github fill:#4a90e2,color:white
    classDef core fill:#50C878,color:white
    classDef external fill:#9370DB,color:white
    classDef security fill:#FFD700,color:black
    
    %% Legend
    subgraph Legend
        L1[GitHub Components]:::github
        L2[Core Components]:::core
        L3[External Services]:::external
        L4[Security Components]:::security
    end

    %% GitHub Environment
    subgraph GitHub
        GE[GitHub Event Trigger]:::github
        GS[(GitHub Secrets)]:::security
        GA[Action Definition]:::github
    end

    %% Action Runtime
    subgraph ActionRuntime
        CR[Container Runtime]:::core
        EP[Entry Point]:::core
        MA[Main Application]:::core
        SP[Shell Processor]:::core
        
        CR --> EP
        EP --> MA
        MA --> SP
    end

    %% External Services
    subgraph ExternalServices
        HV[(HashiCorp Vault)]:::external
        SA[Slack API]:::external
    end

    %% Main Flow
    GE --> GA
    GA --> CR
    GS --> |Webhook URL| MA
    GS --> |Vault Credentials| MA
    MA --> |Optional| HV
    HV --> |Webhook URL| MA
    MA --> |Message| SA

    %% Click Events
    click GA "https://github.com/ofirshtrull/action-webhook-slack-notify/blob/master/action.yml"
    click CR "https://github.com/ofirshtrull/action-webhook-slack-notify/tree/master/Dockerfile"
    click EP "https://github.com/ofirshtrull/action-webhook-slack-notify/blob/master/entrypoint.sh"
    click MA "https://github.com/ofirshtrull/action-webhook-slack-notify/blob/master/main.go"
    click SP "https://github.com/ofirshtrull/action-webhook-slack-notify/blob/master/main.sh"
```
