# kashifahmed/downstream-merge architecture

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

- Interactive diagram: https://gitdiagram.com/kashifahmed/downstream-merge
- Repository: https://github.com/kashifahmed/downstream-merge

## Overview

Downstream PR is a GitHub Actions workflow that propagates merged changes along a branch chain by opening downstream pull requests, checking for conflicts, and notifying a team. The README documents validation, user mapping, branch resolution, diff and duplicate checks, PR creation, conflict detection, and Slack alerts; the only workflow source is present in the tree but was not excerpted, so the graph reflects documented behavior rather than inspected implementation.

Main entry points: [`.github/workflows/downstream-pr.yml`](https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml) (Downstream workflow), [`.github/slack-users.json`](https://github.com/kashifahmed/downstream-merge/blob/master/.github/slack-users.json) (Slack user mapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Workflow orchestration"]
  node_workflow["Downstream workflow<br/>[downstream-pr.yml]"]
  node_validation["Validate environment<br/>[downstream-pr.yml]"]
  node_user_mapping["Load user mapping<br/>[downstream-pr.yml]"]
end

subgraph group_promotion["Branch promotion"]
  node_branch_resolution["Resolve target branch<br/>[downstream-pr.yml]"]
  node_diff_check["Check branch diff<br/>[downstream-pr.yml]"]
  node_duplicate_check["Check existing PR<br/>[downstream-pr.yml]"]
  node_pr_creation["Create downstream PR<br/>[downstream-pr.yml]"]
  node_conflict_check["Check conflicts<br/>[downstream-pr.yml]"]
end

subgraph group_notifications["Notifications"]
  node_mapping_file["Slack user mapping<br/>[slack-users.json]"]
  node_slack_notify["Send Slack alert<br/>[downstream-pr.yml]"]
end

node_developer(("Developer"))
node_merge(("Upstream merge"))
node_actions{{"GitHub Actions"}}
node_github{{"GitHub repository"}}
node_slack{{"Slack"}}

node_developer -->|"merges changes"| node_merge
node_merge -->|"triggers on push"| node_workflow
node_actions -->|"runs"| node_workflow
node_workflow -->|"validates"| node_validation
node_workflow -->|"loads mapping"| node_user_mapping
node_user_mapping -->|"reads"| node_mapping_file
node_workflow -->|"resolves target"| node_branch_resolution
node_workflow -->|"checks commits"| node_diff_check
node_workflow -->|"checks open PRs"| node_duplicate_check
node_workflow -->|"creates PR"| node_pr_creation
node_workflow -->|"checks conflicts"| node_conflict_check
node_diff_check -->|"reads branch state"| node_github
node_duplicate_check -->|"queries PRs"| node_github
node_pr_creation -->|"opens PR"| node_github
node_conflict_check -->|"checks PR conflicts"| node_github
node_workflow -.->|"notifies events"| node_slack_notify
node_slack_notify -.->|"posts webhook"| node_slack

click node_workflow "https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml"
click node_validation "https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml"
click node_user_mapping "https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml"
click node_mapping_file "https://github.com/kashifahmed/downstream-merge/blob/master/.github/slack-users.json"
click node_branch_resolution "https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml"
click node_diff_check "https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml"
click node_duplicate_check "https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml"
click node_pr_creation "https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml"
click node_conflict_check "https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml"
click node_slack_notify "https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml"

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_workflow,node_validation,node_user_mapping toneBlue
class node_branch_resolution,node_diff_check,node_duplicate_check,node_pr_creation,node_conflict_check toneAmber
class node_mapping_file,node_slack_notify toneMint
class node_developer,node_merge,node_actions,node_github,node_slack toneIndigo
```

## Components

### Workflow orchestration

- [Downstream workflow](https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml): `.github/workflows/downstream-pr.yml`
- [Validate environment](https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml): `.github/workflows/downstream-pr.yml`
- [Load user mapping](https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml): `.github/workflows/downstream-pr.yml`

### Branch promotion

- [Resolve target branch](https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml): `.github/workflows/downstream-pr.yml`
- [Check branch diff](https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml): `.github/workflows/downstream-pr.yml`
- [Check existing PR](https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml): `.github/workflows/downstream-pr.yml`
- [Create downstream PR](https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml): `.github/workflows/downstream-pr.yml`
- [Check conflicts](https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml): `.github/workflows/downstream-pr.yml`

### Notifications

- [Slack user mapping](https://github.com/kashifahmed/downstream-merge/blob/master/.github/slack-users.json): `.github/slack-users.json`
- [Send Slack alert](https://github.com/kashifahmed/downstream-merge/blob/master/.github/workflows/downstream-pr.yml): `.github/workflows/downstream-pr.yml`

### Other components

- **Developer**
- **Upstream merge**
- **GitHub Actions**
- **GitHub repository**
- **Slack**

## Connections

- Developer → Upstream merge: merges changes (evidence: `README.md`)
- Upstream merge → Downstream workflow: triggers on push (evidence: `README.md`)
- GitHub Actions → Downstream workflow: runs (evidence: `README.md`)
- Downstream workflow → Validate environment: validates (evidence: `README.md`)
- Downstream workflow → Load user mapping: loads mapping (evidence: `README.md`)
- Load user mapping → Slack user mapping: reads (evidence: `README.md`)
- Downstream workflow → Resolve target branch: resolves target (evidence: `README.md`)
- Downstream workflow → Check branch diff: checks commits (evidence: `README.md`)
- Downstream workflow → Check existing PR: checks open PRs (evidence: `README.md`)
- Downstream workflow → Create downstream PR: creates PR (evidence: `README.md`)
- Downstream workflow → Check conflicts: checks conflicts (evidence: `README.md`)
- Check branch diff → GitHub repository: reads branch state (evidence: `README.md`)
- Check existing PR → GitHub repository: queries PRs (evidence: `README.md`)
- Create downstream PR → GitHub repository: opens PR (evidence: `README.md`)
- Check conflicts → GitHub repository: checks PR conflicts (evidence: `README.md`)
- Downstream workflow → Send Slack alert: notifies events (evidence: `README.md`)
- Send Slack alert → Slack: posts webhook (evidence: `README.md`)
