Skip to content

Add support for importing safe-outputs.jobs from shared workflows#4782

Merged
pelikhan merged 3 commits intomainfrom
copilot/add-import-support-safe-outputs
Nov 25, 2025
Merged

Add support for importing safe-outputs.jobs from shared workflows#4782
pelikhan merged 3 commits intomainfrom
copilot/add-import-support-safe-outputs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 25, 2025

safe-outputs.jobs defined in shared workflows (via imports:) were not being merged into the main workflow.

Changes

  • Schema fix: Added missing name and description properties to safe-outputs.jobs in main_workflow_schema.json (already present in included_file_schema.json)
  • Compiler fix: Updated job merge logic to always use the merged includedSafeJobs result, which already contains both main and imported jobs with conflict detection

Example

# shared/jobs.md
---
safe-outputs:
  jobs:
    notify:
      runs-on: ubuntu-latest
      steps:
        - run: echo "Notified"
---
# workflow.md
---
on: issues
imports:
  - shared/jobs.md
safe-outputs:
  jobs:
    cleanup:
      runs-on: ubuntu-latest
      steps:
        - run: echo "Cleaned"
---

Both notify and cleanup jobs are now correctly included in the compiled workflow.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Add support to imports safe-outputs.jobs from a shared agentic workflow.


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

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for importing safe-outputs.jobs from shared workflow Add support for importing safe-outputs.jobs from shared workflows Nov 25, 2025
Copilot AI requested a review from pelikhan November 25, 2025 22:04
@pelikhan pelikhan marked this pull request as ready for review November 25, 2025 23:26
Copilot AI review requested due to automatic review settings November 25, 2025 23:26
Copy link
Copy Markdown
Contributor

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 a bug where safe-outputs.jobs defined in shared workflows (via imports:) were not being merged into the main workflow. The root cause was an incorrect condition that prevented assignment of merged jobs when the main workflow already had jobs defined.

Key changes:

  • Fixed the compiler logic to always use the merged jobs result, which already contains both main and imported jobs
  • Added missing name and description properties to the main workflow schema for consistency with the included file schema
  • Added comprehensive test coverage for job imports, including conflict detection

Reviewed changes

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

File Description
pkg/workflow/compiler.go Removed incorrect condition that prevented merged jobs assignment when main workflow had existing jobs, ensuring both main and imported jobs are always included
pkg/parser/schemas/main_workflow_schema.json Added name and description properties to safe-outputs.jobs schema to match included_file_schema.json
pkg/workflow/safe_outputs_import_test.go Added three comprehensive test cases covering: importing jobs only, combining main and imported jobs, and detecting job name conflicts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@pelikhan pelikhan merged commit 39afa3d into main Nov 25, 2025
21 checks passed
@pelikhan pelikhan deleted the copilot/add-import-support-safe-outputs branch November 25, 2025 23:51
github-actions Bot added a commit that referenced this pull request Nov 26, 2025
Updates documentation for three major features merged in the last 24 hours:

1. CLI --ref flag (#4776)
   - Add --ref flag to gh aw status command
   - Add --ref flag to gh aw logs command
   - Shows latest run status when filtering by branch/tag

2. Import safe-outputs from shared workflows (#4761, #4782)
   - Document safe-outputs importing capability
   - Document safe output jobs import support
   - Explain conflict detection and meta field precedence

3. Custom job outputs support (#4778)
   - Document job output definition syntax
   - Show usage in agent prompts with needs context
   - Note string value requirement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

3 participants