Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 25, 2025

The validate-workflows.yml GitHub Actions workflow was broken and could not run successfully due to several issues:

Problems Fixed

Missing Dependencies & Directory Structure

  • The workflow referenced a non-existent ./lib directory for dependency installation
  • Attempted to install from missing requirements.txt file
  • Used undefined n8n-validate and n8n-visualize commands that don't exist in the repository

Overly Complex Functionality

  • Included visualization generation steps that required external tools not available in the repository
  • Had complex artifact upload and PR commenting logic dependent on missing functionality

Solution

New Validation Script

  • Created tools/validate_workflows.py that leverages the existing repository structure
  • Validates JSON syntax of all workflow files (284 files processed successfully)
  • Handles n8n export files with trailing metadata text (common in n8n workflow exports)
  • Checks basic n8n workflow structure (presence of nodes array)
  • Excludes known utility files (ALL_unique_nodes.json, all_templates.json)
  • Provides clear error messages and supports verbose output mode

Simplified Workflow

  • Removed dependency installation steps and non-existent tool calls
  • Eliminated visualization creation and artifact upload functionality
  • Streamlined PR commenting to focus on validation results
  • Reduced workflow complexity from 134 lines to 79 lines

Testing

The updated workflow has been tested and:

  • ✅ Successfully validates all 284 workflow files in the repository
  • ✅ Properly detects and reports invalid JSON syntax
  • ✅ Maintains proper exit codes for CI/CD integration
  • ✅ YAML syntax validation passes

The workflow now uses only standard Python libraries and the existing repository structure, making it maintainable and reliable for continuous integration.

Original prompt

On validate-workflows.yml, ok


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] ok Fix validate-workflows.yml GitHub Actions workflow Sep 25, 2025
@Copilot Copilot AI requested a review from sahiixx September 25, 2025 09:07
Copilot finished work on behalf of sahiixx September 25, 2025 09:07
@sahiixx sahiixx marked this pull request as ready for review September 25, 2025 09:13
@Copilot Copilot AI review requested due to automatic review settings September 25, 2025 09:13
Copy link

github-actions bot commented Sep 25, 2025

✅ All 286 n8n workflow files are valid!

@sahiixx sahiixx merged commit 4f81036 into main Sep 25, 2025
2 checks passed
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the broken validate-workflows.yml GitHub Actions workflow by creating a new Python validation script and simplifying the workflow configuration. The changes remove dependencies on non-existent tools and directories while maintaining proper JSON validation functionality.

  • Creates a new tools/validate_workflows.py script that validates workflow JSON syntax and basic n8n structure
  • Removes dependency installation steps and calls to undefined n8n-validate/n8n-visualize commands
  • Simplifies workflow by removing visualization generation and artifact upload functionality

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tools/validate_workflows.py New Python validation script that checks JSON syntax and n8n workflow structure
.github/workflows/validate-workflows.yml Simplified workflow that uses the new validation script instead of missing dependencies

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +89 to +90
if len(nodes) == 0:
return False, "Empty nodes array - workflow should have at least one node"
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This validation rule may be too strict. n8n allows workflows with empty nodes arrays as templates or incomplete workflows. Consider making this a warning rather than a hard error, or make it configurable via a command-line flag.

Copilot uses AI. Check for mistakes.

(is_valid, error_message) - error_message is None if valid
"""
try:
with open(path, 'r', encoding='utf-8', errors='ignore') as f:
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using errors='ignore' silently discards encoding errors which could mask data corruption issues. Consider using errors='replace' or errors='strict' with proper error handling to ensure data integrity during validation.

Suggested change
with open(path, 'r', encoding='utf-8', errors='ignore') as f:
with open(path, 'r', encoding='utf-8') as f:

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants