# r4jrandy/job-automation architecture

> Architecture diagram of the GitHub repository r4jrandy/job-automation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/r4jrandy/job-automation
- Repository: https://github.com/r4jrandy/job-automation

## Overview

This repository packages an n8n portal-alert workflow and supports running it through n8n or GitHub Actions. The documented workflow is imported from the workflows directory at startup; for Actions execution, the workflow JSON should include an Execute Workflow Trigger connected to its first processing node. The Actions token helper exchanges Google refresh tokens and writes short-lived access tokens to `.env`. The workflow JSON and Actions configuration were not sampled, so their internal wiring is not shown.

Main entry points: [`scripts/refresh-google-tokens.js`](https://github.com/r4jrandy/job-automation/blob/main/scripts/refresh-google-tokens.js) (Token refresh), [`.github/workflows/run-portal-alerts.yml`](https://github.com/r4jrandy/job-automation/blob/main/.github/workflows/run-portal-alerts.yml) (GitHub Actions), [`workflows/portal-alerts.json`](https://github.com/r4jrandy/job-automation/blob/main/workflows/portal-alerts.json) (Portal alerts), [`credentials/credentials.template.json`](https://github.com/r4jrandy/job-automation/blob/main/credentials/credentials.template.json) (Credential template)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_automation["Workflow automation"]
  node_n8n["n8n runtime"]
  node_portal_workflow["Portal alerts<br/>[portal-alerts.json]"]
end

subgraph group_actions["Actions execution"]
  node_actions_runner["GitHub Actions"]
end

subgraph group_google["Google credentials"]
  node_token_helper["Token refresh"]
  node_google_oauth["Google OAuth"]
  node_access_tokens["Access tokens"]
  node_credential_template["Credential template"]
end

node_n8n -->|"imports at startup"| node_portal_workflow
node_token_helper -->|"exchanges refresh tokens"| node_google_oauth
node_token_helper -->|"writes to .env"| node_access_tokens
node_actions_runner -->|"imports Google credentials"| node_credential_template

click node_portal_workflow "https://github.com/r4jrandy/job-automation/blob/main/workflows/portal-alerts.json"
click node_actions_runner "https://github.com/r4jrandy/job-automation/blob/main/.github/workflows/run-portal-alerts.yml"
click node_token_helper "https://github.com/r4jrandy/job-automation/blob/main/scripts/refresh-google-tokens.js"
click node_credential_template "https://github.com/r4jrandy/job-automation/blob/main/credentials/credentials.template.json"

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_n8n,node_portal_workflow toneBlue
class node_actions_runner toneAmber
class node_token_helper,node_google_oauth,node_access_tokens,node_credential_template toneMint
```

## Components

### Workflow automation

- **n8n runtime**
- [Portal alerts](https://github.com/r4jrandy/job-automation/blob/main/workflows/portal-alerts.json): `workflows/portal-alerts.json`

### Actions execution

- [GitHub Actions](https://github.com/r4jrandy/job-automation/blob/main/.github/workflows/run-portal-alerts.yml): `.github/workflows/run-portal-alerts.yml`

### Google credentials

- [Token refresh](https://github.com/r4jrandy/job-automation/blob/main/scripts/refresh-google-tokens.js): `scripts/refresh-google-tokens.js`
- **Google OAuth**
- **Access tokens**
- [Credential template](https://github.com/r4jrandy/job-automation/blob/main/credentials/credentials.template.json): `credentials/credentials.template.json`

## Connections

- n8n runtime → Portal alerts: imports at startup (evidence: `README.md`)
- Token refresh → Google OAuth: exchanges refresh tokens (evidence: `scripts/refresh-google-tokens.js`)
- Token refresh → Access tokens: writes to .env (evidence: `scripts/refresh-google-tokens.js`)
- GitHub Actions → Credential template: imports Google credentials (evidence: `README.md`)
