# nicklegan/github-enterprise-user-totals-report-action architecture

> Architecture diagram of the GitHub repository nicklegan/github-enterprise-user-totals-report-action, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nicklegan/github-enterprise-user-totals-report-action
- Repository: https://github.com/nicklegan/github-enterprise-user-totals-report-action

## Overview

##### Project type and purpose
- This is an open-source GitHub Action (“GitHub Enterprise User Totals Report Action”).
- Purpose: When run (on schedule or manually), it queries a GitHub Enterprise Cloud instance for user counts (owners, members, outside collaborators), generates a CSV (and optionally JSON) report, and commits it back to the repository.

##### File structure
- Top-level files:
- action.yml – Action metadata (inputs, outputs, branding, entrypoint)
- index.js – entrypoint for the action (likely a thin wrapper).
- dist/ – compiled JavaScript, bundled for distribution
- package.json & package-lock.json – dependencies (octokit, @actions/core, etc.)
- README.md – usage and inputs
- .github/ – CI and configuration (dependabot, security, CODEOWNERS)
- No frontend/backend split—this is a single, CLI-style component meant to run in the GitHub Actions runtime environment.

##### README for additional insights
- Lists inputs (token, sorting, JSON flag) driven by action.yml
- Describes workflow integration: “uses: nicklegan/github-enterprise-user-totals-report-action@v1.0.0”
- Explains CSV/JSON output format and where it will be saved (reports/ folder)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Trigger and Runner
    Scheduler["Scheduler / Manual Trigger"]:::gh
    Runner["GitHub Actions Runner"]:::gh

    %% Checkout step
    Checkout["actions/checkout"]:::gh

    %% Action Code Subgraph
    subgraph "Action Code (Green)" 
        direction TB
        ActionMetadata["action.yml"]:::action
        EntryPoint["index.js"]:::action
        BusinessLogic["dist/index.js"]:::action
        Licenses["dist/licenses.txt"]:::action
        Dependencies["package.json\npackage-lock.json"]:::dependency
    end

    %% Environment Secret
    EnvSecret["ENT_TOKEN (Secret)"]:::config

    %% External API
    GitHubAPI["GitHub Enterprise Cloud API"]:::gh

    %% Processing and Output
    Generate["Generate CSV/JSON"]:::process
    Output["reports/ folder"]:::output
    Commit["Commit & Push to Repo"]:::process
    Repo["Git Repository"]:::gh

    %% Repository Files for Docs
    subgraph "Repository Files" 
        direction TB
        README["README.md"]:::docs
        LicenseFile["LICENSE"]:::docs
        CodeOwners[".github/CODEOWNERS"]:::docs
        Dependabot[".github/dependabot.yml"]:::docs
        Security[".github/security.md"]:::docs
    end

    %% Connections
    Scheduler -->|"cron / workflow_dispatch"| Runner
    Runner -->|"checkout code"| Checkout
    Checkout --> EntryPoint
    EntryPoint --> BusinessLogic
    Dependencies --> BusinessLogic
    EnvSecret --> BusinessLogic
    BusinessLogic -->|"octokit REST calls"| GitHubAPI
    GitHubAPI -->|user data| BusinessLogic
    BusinessLogic --> Generate
    Generate -->|write files| Output
    Generate -->|git add, commit, push| Commit
    Commit --> Repo

    %% Click Events
    click ActionMetadata "https://github.com/nicklegan/github-enterprise-user-totals-report-action/blob/main/action.yml"
    click EntryPoint "https://github.com/nicklegan/github-enterprise-user-totals-report-action/blob/main/index.js"
    click BusinessLogic "https://github.com/nicklegan/github-enterprise-user-totals-report-action/blob/main/dist/index.js"
    click Licenses "https://github.com/nicklegan/github-enterprise-user-totals-report-action/blob/main/dist/licenses.txt"
    click Dependencies "https://github.com/nicklegan/github-enterprise-user-totals-report-action/blob/main/package.json"
    click Dependencies "https://github.com/nicklegan/github-enterprise-user-totals-report-action/blob/main/package-lock.json"
    click README "https://github.com/nicklegan/github-enterprise-user-totals-report-action/blob/main/README.md"
    click LicenseFile "https://github.com/nicklegan/github-enterprise-user-totals-report-action/tree/main/LICENSE"
    click CodeOwners "https://github.com/nicklegan/github-enterprise-user-totals-report-action/tree/main/.github/CODEOWNERS"
    click Dependabot "https://github.com/nicklegan/github-enterprise-user-totals-report-action/blob/main/.github/dependabot.yml"
    click Security "https://github.com/nicklegan/github-enterprise-user-totals-report-action/blob/main/.github/security.md"

    %% Styles
    classDef gh fill:#B0E0E6,stroke:#333;
    classDef action fill:#98FB98,stroke:#333;
    classDef dependency fill:#F0E68C,stroke:#333;
    classDef config fill:#FFA07A,stroke:#333;
    classDef process fill:#DDA0DD,stroke:#333;
    classDef output fill:#FFD700,stroke:#333;
    classDef docs fill:#EEE8AA,stroke:#333;
```
