N8N Export GitHub
1. Quoi ? — Définition et contexte
Section intitulée « 1. Quoi ? — Définition et contexte »Le workflow N8N Export GitHub exporte automatiquement les workflows N8N modifiés vers un repository GitHub dédié. Il permet le versioning, la restauration facile, et garde un historique des modifications.
Fonctionnalités
Section intitulée « Fonctionnalités »| Fonction | Description |
|---|---|
| Export incrémental | Seuls les workflows modifiés sont exportés |
| Filtrage intelligent | Comparaison des timestamps updatedAt |
| Manifest automatique | Métadonnées de tous les workflows |
| Extraction credentials | Liste les credentials utilisées (sans secrets) |
| Notification Telegram | Résumé des fichiers créés/modifiés |
| Triggers multiples | Schedule, manuel, ou webhook |
Structure du repository
Section intitulée « Structure du repository »stacks_vps_n8n_exports/├── README.md # Auto-généré avec stats├── manifest.json # Métadonnées + updatedAt├── credentials-manifest.json # Liste credentials (sans secrets)└── workflows/ ├── orchestrateur-telegram.json ├── notification-hub.json └── *.json2. Pourquoi ? — Enjeux et motivations
Section intitulée « 2. Pourquoi ? — Enjeux et motivations »Problèmes résolus
Section intitulée « Problèmes résolus »| Problème | Sans export | Avec export |
|---|---|---|
| Perte de workflows | Corruption DB N8N = tout perdu | Restauration depuis GitHub |
| Pas d’historique | Impossible de revenir en arrière | Git history complet |
| Synchro équipe | Export manuel par email | Repository partagé |
| Documentation | Workflows non documentés | README auto-généré |
Pourquoi un export incrémental ?
Section intitulée « Pourquoi un export incrémental ? »| Approche | Avantage | Inconvénient |
|---|---|---|
| Export complet | Simple | Commits inutiles, gros diffs |
| Export incrémental | Commits pertinents, historique propre | Complexité filtrage |
3. Comment ? — Mise en œuvre technique
Section intitulée « 3. Comment ? — Mise en œuvre technique »Architecture
Section intitulée « Architecture »Triggers (Schedule/Manual/Webhook) │ ▼ Get Manifest from GitHub │ ▼ List All Workflows (N8N API) │ ▼ Filter Modified (by updatedAt) │ ├── No changes → "No changes" notification │ ▼ Loop: Get full workflow data │ ▼ Generate Files (JSON + README + Manifest) │ ▼ Loop: Push to GitHub │ ├── Create (if new) └── Update (if exists, with SHA) │ ▼ Telegram NotificationTriggers
Section intitulée « Triggers »| Trigger | Fréquence | Usage |
|---|---|---|
| Schedule | Dimanche 4h | Backup hebdomadaire |
| Manual | On-demand | Tests et debug |
| Webhook | On-demand | Intégration Claude Code |
Déclenchement via webhook :
source /home/guillaume/stacks_vps/n8n-exports/.envcurl -s -X POST "$WEBHOOK_URL" \ -H "X-Export-Token: $X_EXPORT_TOKEN"Filtrage incrémental
Section intitulée « Filtrage incrémental »Filter Modified (Code) :
const manifestNode = $('Get Manifest').first();let existingMap = new Map();
if (manifestNode.json.content) { const manifest = JSON.parse( Buffer.from(manifestNode.json.content, 'base64').toString('utf8') ); existingMap = new Map( manifest.workflows.map(w => [w.id, w.updatedAt]) );}
const workflows = $input.all();const modified = workflows.filter(wf => { const prevUpdatedAt = existingMap.get(wf.json.id); return !prevUpdatedAt || prevUpdatedAt !== wf.json.updatedAt;});
if (modified.length === 0) { return [{ json: { noChanges: true } }];}
return modified;Fichiers générés
Section intitulée « Fichiers générés »manifest.json :
{ "exported_at": "2026-01-20T04:00:00.000Z", "workflow_count": 25, "active_count": 18, "inactive_count": 7, "workflows": [ { "id": "abc123", "name": "Orchestrateur Telegram", "active": true, "updatedAt": "2026-01-19T15:30:00.000Z" } ]}credentials-manifest.json :
{ "exported_at": "2026-01-20T04:00:00.000Z", "credentials": [ { "id": "1", "name": "Telegram Bot", "type": "telegramApi" }, { "id": "2", "name": "GitHub PAT", "type": "gitHubApi" } ]}Notification Telegram
Section intitulée « Notification Telegram »*N8N WORKFLOWS EXPORT*
28/01/2026 04:00
*Created (1):* - new-workflow
*Updated (3):* - orchestrateur-telegram - notification-hub - manifest
Unchanged: 21
[View on GitHub](https://github.com/...)Credentials requises
Section intitulée « Credentials requises »| Credential | Type | Usage |
|---|---|---|
n8n account | n8n API | List/Get workflows |
PAT (classic) | GitHub API | Get/Create/Edit files |
Telegram Bot | Telegram API | Notifications |
4. Et si ? — Perspectives et limites
Section intitulée « 4. Et si ? — Perspectives et limites »Limites actuelles
Section intitulée « Limites actuelles »| Limite | Impact | Mitigation |
|---|---|---|
| Pas de restore automatique | Import manuel dans N8N | Script de restore prévu |
| Credentials non exportés | Recréer manuellement après restore | Seulement les noms sont sauvés |
| Historique Git uniquement | Pas de rollback en un clic | Interface GitHub pour diff |
Scénarios d’évolution
Section intitulée « Scénarios d’évolution »Si besoin de restore automatique :
- Créer un workflow de restore depuis GitHub
- Sélection du workflow et de la version
- Import via API N8N
Si plusieurs instances N8N :
- Adapter le manifest par instance
- Sync bidirectionnelle entre instances
- Gestion des conflits
Si volume de workflows augmente :
- Export par catégorie (actifs uniquement)
- Compression des anciens exports
- Retention policy Git
Commandes utiles
Section intitulée « Commandes utiles »# Voir les exports récentsls -la n8n-exports/workflows/
# Voir les modifications localescd n8n-exports && git status
# Comparer avec une version précédentegit diff HEAD~1 workflows/orchestrateur-telegram.json
# Restaurer un workflow# 1. Copier le JSON depuis GitHub# 2. N8N → Import workflow → Paste JSONTroubleshooting
Section intitulée « Troubleshooting »| Problème | Vérification |
|---|---|
| Pas d’export | Workflow actif ? Cron correct ? |
| 401 GitHub | PAT valide ? Permissions repo ? |
| ”No changes” constant | manifest.json corrompu ? Supprimer et re-run |
| Fichiers en double | Vérifier le filtrage par updatedAt |
Pages liées
Section intitulée « Pages liées »Workflows
Section intitulée « Workflows »- Notification Hub — Notifications Telegram
- Telegram Orchestrator — Trigger manuel
Infrastructure
Section intitulée « Infrastructure »- N8N Queue Mode — Backend automation
Références
Section intitulée « Références »- stacks_vps_n8n_exports — Repository des exports