Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

Completed: Add support to import existing classic GitHub action workflows (.yml)

Summary

Successfully implemented support for importing existing classic GitHub Actions workflows (.yml files) into gh-aw markdown workflows. This allows users to reuse existing workflows, migrate incrementally, and share common jobs.

Recent Updates

  • Merged main branch into feature branch
  • Recompiled all workflows (145 workflows compiled successfully)
  • Updated action pins
  • Changed example to use existing license-check.yml workflow from the repository

Implementation Completed

  • File Type Detection

    • Detects .yml and .yaml extensions (case-insensitive)
    • Rejects .lock.yml files with clear error message
    • Distinguishes between action.yml (GitHub Action definitions) and workflow files
    • Validates that imported files are valid GitHub Actions workflows
  • YAML Workflow Parser

    • Extracts jobs section from YAML workflows
    • Extracts services from job definitions (prefixed with job name)
    • Preserves job dependencies and configuration
    • Handles validation and error reporting
  • Integration with Import Processor

    • Added YAML workflow detection in import processing
    • Early validation to reject .lock.yml files before processing
    • Jobs and services extracted and stored in ImportsResult
    • Proper integration with existing import workflow
  • Merge Logic

    • Merges jobs from YAML workflows with existing jobs
    • Main workflow jobs take precedence (override behavior)
    • Services properly converted and merged
    • Job dependencies preserved
  • Comprehensive Testing

    • Unit tests for file detection and parsing
    • End-to-end tests for job merging
    • Service extraction tests
    • Error case testing (lock files, actions, invalid workflows)
    • All tests passing
  • Example Workflows

    • Created test-yaml-import.md demonstrating YAML import
    • Uses existing license-check.yml from the repository as the import example
    • Successfully compiled and verified job merging
  • Validation

    • make fmt - PASSED
    • make lint - PASSED
    • make test-unit - PASSED
    • Example workflow compilation successful
    • Merged with main branch
    • Recompiled all workflows successfully

Key Features

What Works:
✅ Import classic GitHub Actions YAML workflows into markdown workflows
✅ Extract and merge jobs from imported YAML files
✅ Extract and merge services from job definitions
✅ Preserve job dependencies (needs field)
✅ Reject .lock.yml files with helpful error message
✅ Reject action.yml files (action definitions)
✅ Validate YAML syntax and workflow structure
✅ Main workflow jobs override imported jobs (no conflicts)

Error Handling:

  • Clear error messages for rejected file types
  • Validation of YAML syntax and workflow structure
  • Helpful suggestions for resolving issues

Tested Scenarios:

  • Importing simple YAML workflows with multiple jobs
  • Workflows with services
  • Job dependency chains
  • Rejecting lock files and action definitions
  • Invalid workflow detection
  • Importing real repository workflows (license-check.yml)

Example Usage

---
name: Test YAML Import
on: issue_comment
imports:
  - license-check.yml
engine: copilot
---

# Test YAML Import

This workflow imports the existing License Check workflow (license-check.yml) to demonstrate the YAML import feature.

The compiled workflow will include the license-check job from the imported YAML file, demonstrating how existing GitHub Actions workflows can be seamlessly integrated into gh-aw markdown workflows.

Files Changed

New Files:

  • pkg/parser/yaml_import.go - YAML workflow parsing logic
  • pkg/parser/yaml_import_test.go - Unit tests
  • pkg/parser/yaml_import_e2e_test.go - End-to-end tests
  • .github/workflows/test-yaml-import.md - Example markdown workflow

Modified Files:

  • pkg/parser/import_processor.go - Added YAML import handling
  • pkg/workflow/compiler_orchestrator_workflow.go - Added job merging logic

All validation passed. Feature is complete and ready for review!

Original prompt

Add support to import existing classic GitHub action workflows (.yml)

  • refuse .lock.yml files
  • import/merge all jobs, services

Uses frontmatter imports field. Automatically detect action workflow file and treat specially.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits January 30, 2026 15:27
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support to import classic GitHub action workflows Add support for importing classic GitHub Actions workflows (.yml) Jan 30, 2026
Copilot AI requested a review from pelikhan January 30, 2026 15:37
@pelikhan pelikhan marked this pull request as ready for review January 30, 2026 15:38
@pelikhan
Copy link
Contributor

@copilot merge main, recompile

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot use ci.yml as example

Copilot AI and others added 2 commits January 30, 2026 15:49
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 30, 2026

@copilot merge main, recompile

Completed:

  • Merged main branch (commit 997eafd)
  • Recompiled all workflows (145 workflows compiled successfully)
  • Updated action pins (commit 5ceec97)

…ample

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 30, 2026

@copilot use ci.yml as example

Changed to use license-check.yml as the example (commit a82fac7). The ci.yml file has template injection vulnerabilities that prevent compilation in gh-aw, so I used license-check.yml which is a simpler, safer example from the repository.

Copilot AI and others added 2 commits January 30, 2026 08:32
#12784)

* Initial plan

* Initial analysis of failing Integration: Workflow Misc Part 2 tests

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Fix deprecated fields validation by adding timeout_minutes to schema

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Fix template expression wrapping and update integration tests

- Added extractAndReplacePlaceholders() and generatePlaceholderName() to runtime_import.cjs to convert template conditionals with GitHub expressions to placeholders
- Updated integration tests to reflect that main workflow markdown uses runtime-import, so placeholders are generated at runtime, not during compilation
- Tests now check for placeholders in the GitHub context section (which is in compiled YAML) and verify runtime-import macro is present for user content

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Fix action pins count and update parser test for timeout_minutes

- Updated TestGetActionPinsSorting to expect 43 pins instead of 42
- Updated TestGetMainWorkflowDeprecatedFields to expect timeout_minutes in deprecated list
- This allows strict mode to properly detect and reject deprecated timeout_minutes field

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan merged commit 96e9001 into main Jan 30, 2026
52 checks passed
@pelikhan pelikhan deleted the copilot/add-support-import-github-actions branch January 30, 2026 16:47
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