# illeniumstudios/fivem-resource-watcher architecture

> Architecture diagram of the GitHub repository illeniumstudios/fivem-resource-watcher, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/illeniumstudios/fivem-resource-watcher
- Repository: https://github.com/illeniumstudios/fivem-resource-watcher

## Overview

1. This repository is a GitHub Action that automates FiveM resource restarts after repository changes. Its core responsibility is change detection plus issuing the appropriate restart command against a FiveM server.

2. The action is packaged for GitHub Actions execution using a `Dockerfile` and `entrypoint.sh`, with `action.yml` serving as the action manifest. That means the runtime boundary is the GitHub Actions runner, while the action logic itself is encapsulated in the container/entrypoint layer.

3. The main input boundary is the action configuration: server address/port, resource folder name, resource ignore list, and restart mode flags. The action is controlled by GitHub Actions secrets and workflow context rather than by a standalone CLI or daemon.

4. The primary data flow is: GitHub push event → action receives the previous commit SHA via `GITHUB_EVENT_BEFORE` → action determines which files/resources changed → action decides whether to restart individual resources or the whole server. The `restartServerWhen0Players` option can override normal resource-level restarts when the server is empty.

5. Resource-level targeting is centered on a configurable resources directory, defaulting to `resources`. The action maps repository changes into the corresponding FiveM resource boundaries and can exclude specific resources via `resourcesToIgnore`.

6. The server-control boundary is FiveM RCON. The repository docs require `rcon_password` on the server and an `RCON_PASSWORD` secret in GitHub, so the action’s effect is mediated through the FiveM server’s remote command interface rather than direct filesystem manipulation.

7. The remote deployment step is intentionally separate from the restart step. The README’s example workflow first uses SSH to `git pull` updated code onto the server, then runs this action to restart only what changed. That creates a two-stage pipeline: sync code first, then apply runtime reloads.

8. SSH is not part of the action’s core restart logic, but it is an important adjacent subsystem in the overall deployment architecture described by the repo. The provided examples use `appleboy/ssh-action` to connect to either Linux or Windows servers, with password- or key-based authentication.

9. The repository includes `example-pipelines/` with sample workflow YAMLs that demonstrate the intended integration pattern. These examples act as reference architecture for how the action is consumed in real CI/CD pipelines.

10. The external system boundaries are the GitHub repository, the remote VPS/dedicated server, and the live FiveM server process. The action sits in the middle, translating repository diffs into RCON restart commands after the server code has been pulled onto the machine.

11. Operationally, the architecture assumes the server process and the repository checkout are already linked on the host. The action does not deploy files itself; it coordinates post-pull restarts based on repository change metadata.

12. In diagram terms, the central components are: GitHub push trigger, GitHub Action container, diff/change analysis, restart decision logic, and FiveM RCON target. Surrounding these are the SSH-based sync step, repository secrets, and the server-side repo checkout that makes the restarted code live.

Main entry points: [`entrypoint.sh`](https://github.com/illeniumstudios/fivem-resource-watcher/blob/main/entrypoint.sh) (Entrypoint), [`action.yml`](https://github.com/illeniumstudios/fivem-resource-watcher/blob/main/action.yml) (Action spec), [`example-pipelines`](https://github.com/illeniumstudios/fivem-resource-watcher/tree/main/example-pipelines) (Example workflows), [`Dockerfile`](https://github.com/illeniumstudios/fivem-resource-watcher/tree/main/Dockerfile) (Action image)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_github["GitHub / CI"]
  node_push(("Push event<br/>github trigger"))
  node_before_sha["Before SHA<br/>event context"]
end

subgraph group_action["Action runtime"]
  node_manifest["Action spec<br/>workflow manifest<br/>[action.yml]"]
  node_container["Action image<br/>container runtime"]
  node_entrypoint["Entrypoint<br/>shell launcher<br/>[entrypoint.sh]"]
  node_config{{"Action inputs<br/>runtime config"}}
  node_diff["Change scan<br/>diff analysis"]
  node_resource_map["Resource map<br/>path routing"]
  node_ignore["Ignore list<br/>filter rule"]
  node_decision{{"Restart logic<br/>policy engine"}}
  node_empty_override{{"Empty-server rule<br/>override flag"}}
end

subgraph group_deploy["Deployment target"]
  node_rcon["RCON command<br/>remote control"]
  node_checkout["Server checkout<br/>deployed repo"]
  node_fivem(("FiveM server<br/>runtime process"))
  node_ssh_sync["SSH sync<br/>deployment step"]
end

subgraph group_examples["Examples"]
  node_pipelines["Example workflows<br/>sample integration"]
end

node_push -->|"provides"| node_before_sha
node_push -->|"starts"| node_manifest
node_manifest -->|"runs in"| node_container
node_container -->|"launches"| node_entrypoint
node_entrypoint -->|"reads"| node_config
node_entrypoint -->|"invokes"| node_diff
node_before_sha -->|"bounds"| node_diff
node_diff -->|"feeds"| node_resource_map
node_resource_map -->|"filters"| node_ignore
node_resource_map -->|"inputs"| node_decision
node_config -->|"controls"| node_decision
node_empty_override -->|"overrides"| node_decision
node_decision -->|"emits"| node_rcon
node_rcon -->|"targets"| node_fivem
node_ssh_sync -->|"updates"| node_checkout
node_checkout -->|"serves"| node_fivem
node_pipelines -.->|"demonstrates"| node_ssh_sync
node_pipelines -.->|"uses"| node_manifest

click node_manifest "https://github.com/illeniumstudios/fivem-resource-watcher/blob/main/action.yml"
click node_container "https://github.com/illeniumstudios/fivem-resource-watcher/tree/main/Dockerfile"
click node_entrypoint "https://github.com/illeniumstudios/fivem-resource-watcher/blob/main/entrypoint.sh"
click node_pipelines "https://github.com/illeniumstudios/fivem-resource-watcher/tree/main/example-pipelines"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_push,node_before_sha toneBlue
class node_manifest,node_container,node_entrypoint,node_config,node_diff,node_resource_map,node_ignore,node_decision,node_empty_override toneAmber
class node_rcon,node_checkout,node_fivem,node_ssh_sync toneMint
class node_pipelines toneRose
```

## Components

### GitHub / CI

Workflow trigger and action packaging on GitHub

- **Push event**: github trigger · Repository change event that starts the workflow
- **Before SHA**: event context · Previous commit reference from the GitHub event payload

### Action runtime

Container entrypoint and restart logic

- [Action spec](https://github.com/illeniumstudios/fivem-resource-watcher/blob/main/action.yml): workflow manifest · GitHub Actions metadata and input contract · `action.yml`
- [Action image](https://github.com/illeniumstudios/fivem-resource-watcher/tree/main/Dockerfile): container runtime · Packaged execution environment for the action · `Dockerfile`
- [Entrypoint](https://github.com/illeniumstudios/fivem-resource-watcher/blob/main/entrypoint.sh): shell launcher · Container entry script that runs the action logic · `entrypoint.sh`
- **Action inputs**: runtime config · Server, resource, ignore, and restart flags plus secrets
- **Change scan**: diff analysis · Determines which files and resources changed
- **Resource map**: path routing · Maps changed paths into FiveM resource boundaries
- **Ignore list**: filter rule · Excludes configured resources from restart decisions
- **Restart logic**: policy engine · Chooses resource-level restart or full server restart
- **Empty-server rule**: override flag · Forces server restart behavior when the server has 0 players

### Deployment target

Remote host and FiveM server boundary

- **RCON command**: remote control · Issues restart commands through FiveM RCON
- **Server checkout**: deployed repo · Repository copy already present on the remote host
- **FiveM server**: runtime process · Live server process that receives restart commands
- **SSH sync**: deployment step · Pulls updated code onto the remote host before restart

### Examples

Reference pipeline integrations

- [Example workflows](https://github.com/illeniumstudios/fivem-resource-watcher/tree/main/example-pipelines): sample integration · Reference GitHub Actions pipelines for Linux and Windows setups · `example-pipelines`

## Connections

- Push event → Before SHA: provides · Workflow uses the previous commit from the event payload
- Push event → Action spec: starts · Repository event launches the GitHub Action
- Action spec → Action image: runs in · Action metadata selects the containerized runtime
- Action image → Entrypoint: launches · Container starts the shell entrypoint
- Entrypoint → Action inputs: reads · Entrypoint consumes action inputs and secrets
- Entrypoint → Change scan: invokes · Runtime begins change detection
- Before SHA → Change scan: bounds · Previous SHA defines the diff range
- Change scan → Resource map: feeds · Changed paths are mapped to resource boundaries
- Resource map → Ignore list: filters · Configured ignore list removes excluded resources
- Resource map → Restart logic: inputs · Resource-level impacts drive restart selection
- Action inputs → Restart logic: controls · Flags and server settings influence restart policy
- Empty-server rule → Restart logic: overrides · Empty-server mode can supersede normal resource restarts
- Restart logic → RCON command: emits · Chosen restart action is sent as an RCON command
- RCON command → FiveM server: targets · Remote control interface reaches the live server process
- SSH sync → Server checkout: updates · SSH step pulls repository changes onto the host
- Server checkout → FiveM server: serves · Server restarts apply to the already-synced checkout
- Example workflows → SSH sync: demonstrates · Examples show the code-sync step before restart
- Example workflows → Action spec: uses · Examples illustrate how the action is wired into workflows
