# eepurichandra/github-action-matrix-outputs-read architecture

> Architecture diagram of the GitHub repository eepurichandra/github-action-matrix-outputs-read, 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/eepurichandra/github-action-matrix-outputs-read
- Repository: https://github.com/eepurichandra/github-action-matrix-outputs-read

## Overview

##### Main Components
- GitHub Actions Workflows: Represent the various workflow YAML files that drive different tests, builds, and releases (e.g., feature-branch, main-branch, release, setup-test, and multiple test workflows). These are the automation “pipelines” triggered by events (e.g., pull_request).
- Matrix Outputs Write Action: This component (referenced by cloudposse/github-action-matrix-outputs-write) is where each matrix job writes its outputs.
- Matrix Outputs Read Action: This action (cloudposse/github-action-matrix-outputs-read, the subject of the repository) is used to aggregate or fetch the outputs from the matrix jobs. It is used in subsequent “read” or “assert” jobs.
- Reusable Workflows: Illustrate the additional reusable workflow architecture (.github/workflow/build-reusabled.yaml) that encapsulates the build‐and‐write pattern in an independent workflow file.
- Downstream Jobs: Include downstream jobs that use or reference the matrix outputs (e.g., the “assert” job in the provided examples).

##### Relationships and Data Flow
- That the triggering event (such as a pull_request) launches the primary workflow.
- That the “read” job, depending on the “build” job, uses the Matrix Outputs Read Action to collect and aggregate those outputs.
- For the reusable workflow scenario, show how the build-reusabled.yaml workflow is invoked with matrix parameters and how its outputs eventually flow into subsequent jobs.

##### Architectural Patterns and Design Principles
- Use of a workaround pattern to overcome inherent GitHub Actions limitations regarding matrix outputs.
- Modular pattern; the action is split between write and read operations, making it easier to reuse in various GitHub Actions workflows.
- Clearly separate concerns between the build phase (producing outputs) and downstream consumption of outputs.
- Mention the integration with external GitHub Actions and GitHub infrastructure components, such as actions/checkout and external assert actions.

##### Relevant Technologies and Frameworks
- GitHub Actions and its YAML-based workflow engine.
- The native matrix strategies supported by GitHub Actions.
- The cloudposse actions (both the write and read actions) that implement the workaround.
- The overall event-driven design triggered by repository events (e.g., pull_request).

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["pull_request (Event)"]:::event

    subgraph "Workflows Directory"
        B["GitHub Actions Workflows"]:::workflow
        click B "https://github.com/eepurichandra/github-action-matrix-outputs-read/tree/main/.github/workflows/"
    end

    subgraph "Matrix Workflows"
        BP["Test Positive Workflow"]:::workflow
        click BP "https://github.com/eepurichandra/github-action-matrix-outputs-read/blob/main/.github/workflows/test-positive.yml"
        BN["Test Negative Workflow"]:::workflow
        click BN "https://github.com/eepurichandra/github-action-matrix-outputs-read/blob/main/.github/workflows/test-negative.yml"
    end

    A -->|"triggers"| B
    B -->|"contains"| BP
    B -->|"contains"| BN

    C["Build Job with Matrix Strategy"]:::job
    DP["Matrix Outputs Write Action"]:::action
    E["Matrix Outputs Read Action"]:::action
    click E "https://github.com/eepurichandra/github-action-matrix-outputs-read/blob/main/action.yml"
    F["Assertion/Consumption Job"]:::job

    BP -->|"executes"| C
    BN -->|"executes"| C
    C -->|"sends_outputs"| DP
    DP -->|"aggregates"| E
    E -->|"feeds"| F

    subgraph "Reusable Workflows"
        R["Reusable Workflow"]:::workflow
        click R "https://github.com/eepurichandra/github-action-matrix-outputs-read/blob/main/.github/workflows/test-reusable-workflow.yml"
    end

    A -->|"alternative_trigger"| R
    R -->|"invokes_build"| DP

    style A fill:#ffcccc,stroke:#cc0000,stroke-width:2px
    style B fill:#ccffcc,stroke:#006600,stroke-width:2px
    style BP fill:#ccffcc,stroke:#006600,stroke-width:2px
    style BN fill:#ccffcc,stroke:#006600,stroke-width:2px
    style C fill:#ffffcc,stroke:#999900,stroke-width:2px,rx:10,ry:10
    style DP fill:#cce5ff,stroke:#0044cc,stroke-width:2px
    style E fill:#cce5ff,stroke:#0044cc,stroke-width:2px
    style F fill:#ffffcc,stroke:#999900,stroke-width:2px,rx:10,ry:10
    style R fill:#ccffcc,stroke:#006600,stroke-width:2px

    linkStyle default stroke:#333,stroke-width:2px

classDef event fill:#ffcccc,stroke:#cc0000,stroke-width:2px,stroke-dasharray: 5 5;
classDef workflow fill:#ccffcc,stroke:#006600,stroke-width:2px;
classDef job fill:#ffffcc,stroke:#999900,stroke-width:2px,rx:10,ry:10;
classDef action fill:#cce5ff,stroke:#0044cc,stroke-width:2px;
```
