# github/update-project-action architecture

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

- Interactive diagram: https://gitdiagram.com/github/update-project-action
- Repository: https://github.com/github/update-project-action

## Overview

##### Project Type and Purpose
- The project is a GitHub composite action designed specifically to update or obtain field values on GitHub Projects boards. Its purpose is to automate non-production workflows by integrating with GitHub Actions workflows.
- The README clearly shows its usage within a GitHub workflow and explains key inputs (like github_token, content_id, operation type, etc.). This means the primary use-case is to streamline project board updates in CI/CD pipelines.

##### File Structure
- Key directories and files include:
- action.yml – the definition file for the composite GitHub Action.
- src/ – which contains the TypeScript source code (main.ts and update-project.ts) that implement the core logic.
- __test__/ – unit tests, indicating a testing layer.
- dist/ – the compiled JavaScript output.
- script/ – various utility scripts for bootstrapping, linting, building, and updating the README.
- Configuration files such as package.json, tsconfig.json, jest.config.js, ESLint, Prettier, and GitHub Actions workflows (in .github/workflows).

##### Key Components
a. GitHub Workflow Trigger:
b. GitHub Action Runner / Composite Action:
- Inside this, include two main execution paths: one for the “read” operation and another for the “update” operation.
c. Source Code Components:
- “src” modules (main.ts and update-project.ts) as processing components that encapsulate the logic to interact with GitHub’s API.
d. External API Interaction:
- GitHub’s API service as an external component which the action communicates with, using the provided github_token to authenticate.
e. Testing and CI/CD Pipeline:

##### Architecture Patterns and Design Principles
- The project follows a modular pattern: separate files for the core logic (src modules) and action metadata (action.yml). It leverages existing developer tools like ESLint, Prettier, Jest, and GitHub Workflows for CI.
- How it integrates with GitHub’s API, which is the external dependency for updating/reading project fields.
- Use of composite steps in a GitHub Action which keeps the design “boring” and understandable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Runtime Flow Components
    A["GitHub Workflow Trigger"]:::runtime
    B["Composite Action Runner (action.yml)"]:::runtime
    C["Read Operation (src/main.ts)"]:::runtime
    D["Update Operation (src/update-project.ts)"]:::runtime
    E["GitHub API Service"]:::external

    %% Connections for Runtime Flow
    A -->|"triggers"| B
    B -->|"executes"| C
    B -->|"executes"| D
    C -->|"calls"| E
    D -->|"calls"| E

    %% Development Tools & CI/CD Subgraph
    subgraph "Development Tools & CI/CD"
        F["Testing Suite (__test__ + jest.config.js)"]:::dev
        G["Linting/Formatting (ESLint,Prettier,yamllint)"]:::dev
        I["Build Scripts (script)"]:::dev
        J["Build Artifacts (dist)"]:::dev
    end

    %% Click Events for Mapped Components
    click A "https://github.com/github/update-project-action/tree/main/.github/workflows"
    click B "https://github.com/github/update-project-action/blob/main/action.yml"
    click C "https://github.com/github/update-project-action/blob/main/src/main.ts"
    click D "https://github.com/github/update-project-action/blob/main/src/update-project.ts"
    click F "https://github.com/github/update-project-action/tree/main/__test__"
    click I "https://github.com/github/update-project-action/tree/main/script"
    click J "https://github.com/github/update-project-action/tree/main/dist"

    %% Styles
    classDef runtime fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef external fill:#D5DBDB,stroke:#566573,stroke-width:2px;
    classDef dev fill:#D4EFDF,stroke:#1E8449,stroke-width:2px,stroke-dasharray: 5, 5;
```
