38 lines
886 B
Python
38 lines
886 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test the workflow directly by execution
|
|
"""
|
|
|
|
import json
|
|
import requests
|
|
|
|
api_key = open('/home/bam/.n8n_api_key').read().strip()
|
|
headers = {
|
|
'X-N8N-API-KEY': api_key,
|
|
'Content-Type': 'application/json'
|
|
}
|
|
|
|
# Execute workflow directly
|
|
workflow_id = 'L0VYVJyEwGsA1bqe'
|
|
url = f'https://n8n.oky.sh/api/v1/workflows/{workflow_id}/execute'
|
|
|
|
test_data = {
|
|
'input': {
|
|
'body': {
|
|
'repository': {
|
|
'name': 'test-project',
|
|
'full_name': 'gitadmin/test-project'
|
|
},
|
|
'head_commit': {
|
|
'message': 'MVP Prompt: Create a test app'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
print(f"Executing workflow {workflow_id}...")
|
|
response = requests.post(url, headers=headers, json=test_data)
|
|
|
|
print(f"Status: {response.status_code}")
|
|
print(f"Response:\n{json.dumps(response.json(), indent=2)}")
|