# robinraju/release-downloader architecture

> Architecture diagram of the GitHub repository robinraju/release-downloader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/robinraju/release-downloader
- Repository: https://github.com/robinraju/release-downloader

## Overview

##### Project type and purpose
- This is an open-source GitHub Action (a Node.js/TypeScript tool) whose sole purpose is to download assets from a GitHub release (public or private), optionally extract them, and expose metadata (tag_name, release_name, downloaded_files) as outputs.

##### File structure
- Top-level “action.yml” defines the Action’s inputs/outputs and entry point.
- “src/” contains TypeScript modules:
- input-helper.ts – reads and validates Action inputs
- download-settings.ts – builds a concrete settings object from inputs + defaults
- gh-api.ts – wraps GitHub REST API calls (fetch release by latest/tag/id)
- release-downloader.ts – downloads selected assets (wildcards, tarBall, zipBall)
- unarchive.ts – inspects downloaded files and extracts archives if requested
- main.ts – orchestrates the workflow
- “dist/” holds the compiled JavaScript version of the above modules (index.js) plus licenses.txt.
- Test fixtures in “__tests__” validate scenarios against sample JSON and asset files.

##### README for additional insights
- Confirms it’s a GitHub Action used in workflows via “uses: robinraju/release-downloader@v1”.
- Lists all configurable inputs and expected outputs (tag_name, etc.).
- Describes typical scenarios (latest release, specific tag, wildcard, extraction).

##### Additional Advice
- Make the orchestration flow (main.ts) prominent—this is your "backbone."
- Modules in a larger “Action code” container, distinct from the external GitHub API and the filesystem.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Environment
    Runner["GitHub Actions Runner"]:::external

    %% Action Entry
    subgraph "Action Entry"
        ActionYml["action.yml"]:::config
        DistIndexEntry["dist/index.js"]:::compiled
    end

    %% Core Modules
    subgraph "Action Code"
        InputHelper["InputHelper\n(src/input-helper.ts)"]:::internal
        DownloadSettings["DownloadSettings\n(src/download-settings.ts)"]:::internal
        GHAPI["GH-API\n(src/gh-api.ts)"]:::internal
        ReleaseDownloader["ReleaseDownloader\n(src/release-downloader.ts)"]:::internal
        Unarchive["Unarchive\n(src/unarchive.ts)"]:::internal
    end

    %% External Services and Outputs
    GitHubAPI["GitHub REST API"]:::external
    FileSystem["Local Filesystem\n($GITHUB_WORKSPACE)"]:::storage
    Outputs["Action Outputs\n(tag_name, downloaded_files)"]:::outputs

    %% Compiled Distribution & Licenses
    subgraph "Distribution"
        DistIndex["dist/index.js"]:::compiled
        DistLicenses["dist/licenses.txt"]:::data
    end

    %% Tests
    subgraph "Tests"
        TestsMain["__tests__/main.test.ts"]:::test
        TestFixtures["__tests__/resource/**"]:::testdata
    end

    %% Flow
    Runner --> ActionYml
    ActionYml --> DistIndexEntry
    DistIndexEntry --> InputHelper
    InputHelper --> DownloadSettings
    DownloadSettings --> GHAPI
    GHAPI --> GitHubAPI
    GitHubAPI --> GHAPI
    GHAPI --> ReleaseDownloader
    ReleaseDownloader --> FileSystem
    ReleaseDownloader --> Unarchive
    Unarchive --> FileSystem
    DistIndexEntry --> Outputs

    %% Distribution Links
    ActionYml -.-> DistIndex
    DistIndex --> DistLicenses

    %% Tests Relationships
    TestsMain --> TestFixtures

    %% Click Events
    click ActionYml "https://github.com/robinraju/release-downloader/blob/main/action.yml"
    click DistIndexEntry "https://github.com/robinraju/release-downloader/blob/main/dist/index.js"
    click InputHelper "https://github.com/robinraju/release-downloader/blob/main/src/input-helper.ts"
    click DownloadSettings "https://github.com/robinraju/release-downloader/blob/main/src/download-settings.ts"
    click GHAPI "https://github.com/robinraju/release-downloader/blob/main/src/gh-api.ts"
    click ReleaseDownloader "https://github.com/robinraju/release-downloader/blob/main/src/release-downloader.ts"
    click Unarchive "https://github.com/robinraju/release-downloader/blob/main/src/unarchive.ts"
    click DistIndex "https://github.com/robinraju/release-downloader/blob/main/dist/index.js"
    click DistLicenses "https://github.com/robinraju/release-downloader/blob/main/dist/licenses.txt"
    click TestsMain "https://github.com/robinraju/release-downloader/blob/main/__tests__/main.test.ts"
    click TestFixtures "https://github.com/robinraju/release-downloader/tree/main/__tests__/resource/"

    %% Styles
    classDef external fill:#f9c,stroke:#333,stroke-width:1px
    classDef internal fill:#9cf,stroke:#333,stroke-width:1px
    classDef compiled fill:#c9f,stroke:#333,stroke-width:1px
    classDef config fill:#fc9,stroke:#333,stroke-width:1px
    classDef data fill:#9f9,stroke:#333,stroke-width:1px
    classDef storage fill:#ff9,stroke:#333,stroke-width:1px
    classDef outputs fill:#f99,stroke:#333,stroke-width:1px
    classDef test fill:#ddd,stroke:#333,stroke-width:1px
    classDef testdata fill:#eee,stroke:#333,stroke-width:1px
```
