# mercadolibre/fury-core-ci architecture

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

- Interactive diagram: https://gitdiagram.com/mercadolibre/fury-core-ci
- Repository: https://github.com/mercadolibre/fury-core-ci

## Overview

##### Main components of the system
- GitHub Repository & Webhooks: This is where events like pull requests and issue comments are generated. The workflow listens for GitHub events (e.g., pull_request events of various types and issue_comment events).
- GitHub Workflows: Found under .github/workflows (build.yml and tagging.yml). These files show when and how the CI run is triggered. The tagging workflow, in particular, drives the process using GitHub Action hooks.
- Custom GitHub Action: Defined by action.yml at the root. This descriptor outlines the action's inputs and environment setup. It ties to the business logic contained in the source files.
- Source Code & Build Output: The TypeScript source (index.ts) is compiled via the TypeScript compiler (using tsconfig.json) into JavaScript (located in the dist directory e.g., dist/index.js). This represents the core logic that processes the triggers and creates the appropriate tags.
- Versioning and Branching Conventions: Although not physical components in the file structure, these guidelines (outlined in the README) are integral to understanding how tagging is influenced by branch names and merge events.

##### Relationships and interactions
- GitHub events act as the trigger for the workflows defined in .github/workflows. When an event occurs (like a pull request being opened, synchronized, or an issue comment with "#tag"), GitHub sends a webhook.
- The workflow (from tagging.yml) then checks out the repository code using actions/checkout@v2.
- It subsequently runs the custom action included via the “uses” directive (mercadolibre/fury-core-ci@v1). This action is defined by action.yml and runs the logic compiled into dist/index.js.
- Finally, based on branch naming conventions and PR details (e.g., feature, fix, chore), the custom action creates and pushes the appropriate Git tag.

##### Architectural patterns and key technologies
- Event-Driven Architecture: The system reacts to GitHub webhooks and comments.
- Modular Build: Separation between source (index.ts) and built output (dist directory) with configuration managed by tsconfig.json.
- Continuous Integration and Deployment Pattern: Utilizing GitHub Actions and workflows to streamline tagging.
- Semantic Versioning: Embedded in the business rules and branching conventions that dictate tag creation.

##### Elements
- Clear, descriptive labels for every component (workflows, actions, source files, compilation step, triggers).
- Notes or callouts to show how branching conventions (e.g., feature/, fix/, release/) affect the variant of version increment (major, minor, patch).

##### Detailed architecture capture
- How the GitHub Action responds to event types.
- The flow from checkout to executing the custom action.
- How the tag creation logic integrates semantic versioning and branch naming rules.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Event Trigger
    A["GitHub Webhook Events (PR&IssueComments)"]:::external

    %% Workflow Layer
    subgraph "GitHub Workflows"
        B["Tagging Workflow (.github/workflows/tagging.yml)"]:::config
        C["Build Workflow (.github/workflows/build.yml)"]:::config
    end

    %% Checkout and Custom Action Execution
    D["Checkout Code"]:::config
    E["Custom Action Execution"]:::config
    F["Custom GitHub Action Descriptor (action.yml)"]:::config

    %% Compilation Process
    G["Source Code (index.ts)"]:::logic
    H["TypeScript Configuration (tsconfig.json)"]:::config
    I["Built Code (dist/index.js)"]:::logic

    %% Versioning and Tag Creation
    K["Branching Conventions & Semantic Versioning Logic"]:::logic
    J["Semantic Version Tag Creation"]:::logic

    %% Connections
    A -->|"triggers"| B
    A -->|"triggers"| C
    B -->|"invokes"| D
    D -->|"runs"| E
    E -->|"uses"| F
    F -->|"executes"| G
    G -->|"compiled via"| H
    H -->|"produces"| I
    F -->|"appliesRules"| K
    K -->|"drives"| J
    I -->|"resultsIn"| J

    %% Click Events
    click B "https://github.com/mercadolibre/fury-core-ci/blob/master/.github/workflows/tagging.yml"
    click C "https://github.com/mercadolibre/fury-core-ci/blob/master/.github/workflows/build.yml"
    click F "https://github.com/mercadolibre/fury-core-ci/blob/master/action.yml"
    click G "https://github.com/mercadolibre/fury-core-ci/blob/master/index.ts"
    click I "https://github.com/mercadolibre/fury-core-ci/blob/master/dist/index.js"
    click H "https://github.com/mercadolibre/fury-core-ci/blob/master/tsconfig.json"

    %% Styles
    classDef external fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef config fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef logic fill:#d4edda,stroke:#333,stroke-width:2px;
```
