Skip to content

Commit c7f116d

Browse files
N8N flow
0 parents  commit c7f116d

File tree

298 files changed

+197727
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+197727
-0
lines changed

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: enescingoz
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: enescingoz
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Validate n8n Workflows
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
workflow_dispatch: # Allow manual triggering
9+
10+
jobs:
11+
validate-workflows:
12+
name: Validate n8n Workflows
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.10'
23+
24+
- name: Install dependencies
25+
working-directory: ./lib
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -r requirements.txt
29+
pip install -e .
30+
31+
- name: Run workflow validation
32+
id: validate
33+
working-directory: ./lib
34+
run: |
35+
# Run the validator on all JSON files in the repository
36+
# This will fail if any workflow is invalid
37+
echo "Validating all n8n workflows..."
38+
if ! n8n-validate ..; then
39+
echo "::error::One or more workflow validations failed"
40+
exit 1
41+
fi
42+
echo "All workflows are valid!"
43+
44+
- name: Create visualization artifacts
45+
if: always() # Run this step even if validation fails
46+
working-directory: ./lib
47+
run: |
48+
echo "Creating visualizations for all workflows..."
49+
mkdir -p ../workflow-visualizations
50+
51+
# Find all JSON files that might be n8n workflows
52+
find .. -type f -name "*.json" -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/workflow-visualizations/*" | while read -r file; do
53+
# Try to validate the file first
54+
if n8n-validate "$file" 2>/dev/null; then
55+
# If validation passes, create a visualization
56+
echo "Creating visualization for $file"
57+
filename=$(basename "$file" .json)
58+
output_file="../workflow-visualizations/${filename}.png"
59+
if ! n8n-visualize "$file" -o "$output_file" --no-show 2>/dev/null; then
60+
echo "::warning::Failed to create visualization for $file"
61+
fi
62+
fi
63+
done
64+
65+
# Count the number of visualizations created
66+
VIS_COUNT=$(find ../workflow-visualizations -type f -name "*.png" | wc -l)
67+
echo "Created $VIS_COUNT workflow visualizations"
68+
69+
# Set an output with the visualization count
70+
echo "visualization_count=$VIS_COUNT" >> $GITHUB_OUTPUT
71+
72+
- name: Upload workflow visualizations
73+
if: always() && steps.validate.outcome == 'success'
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: workflow-visualizations
77+
path: workflow-visualizations/
78+
if-no-files-found: ignore
79+
retention-days: 7
80+
81+
- name: Comment on PR with validation results
82+
if: github.event_name == 'pull_request' && steps.validate.outcome == 'success'
83+
uses: actions/github-script@v7
84+
with:
85+
script: |
86+
const fs = require('fs');
87+
const { execSync } = require('child_process');
88+
89+
// Get the list of workflow files that were validated
90+
const workflowFiles = execSync('find .. -type f -name "*.json" -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/workflow-visualizations/*"')
91+
.toString()
92+
.split('\n')
93+
.filter(Boolean);
94+
95+
// Count visualizations
96+
let visCount = 0;
97+
try {
98+
visCount = fs.readdirSync('../workflow-visualizations').length;
99+
} catch (e) {
100+
// Directory might not exist if no visualizations were created
101+
}
102+
103+
// Create a comment
104+
const comment = `✅ All ${workflowFiles.length} n8n workflow files are valid!\n` +
105+
`📊 ${visCount} workflow visualizations were generated and attached as artifacts.`;
106+
107+
// Add a comment to the PR
108+
const { data: comments } = await github.rest.issues.listComments({
109+
owner: context.repo.owner,
110+
repo: context.repo.repo,
111+
issue_number: context.issue.number,
112+
});
113+
114+
const botComment = comments.find(comment =>
115+
comment.user.login === 'github-actions[bot]' &&
116+
comment.body.includes('n8n workflow')
117+
);
118+
119+
if (botComment) {
120+
await github.rest.issues.updateComment({
121+
owner: context.repo.owner,
122+
repo: context.repo.repo,
123+
comment_id: botComment.id,
124+
body: comment,
125+
});
126+
} else {
127+
await github.rest.issues.createComment({
128+
owner: context.repo.owner,
129+
repo: context.repo.repo,
130+
issue_number: context.issue.number,
131+
body: comment,
132+
});
133+
}

0 commit comments

Comments
 (0)