Skip to content

Update workflows cmd replaces valid workflow imports #53703

Description

@mnkiefer

gh aw update removed an unchanged upstream import while updating a sourced workflow.
This caused the recompiled workflow to omit nested imports and their generated steps.

Expected behavior

The unchanged upstream import should remain:

imports:
  - uses: shared/control.md
    with:
      role: orchestrator
      rollout_mode: ${{ vars.CENTRAL_AGENTIC_OPS_DEPENDABOT_MODE || 'preview' }}
      review_repo: ${{ vars.CENTRAL_AGENTIC_OPS_DEPENDABOT_REVIEW_REPO || '' }}

Compilation should traverse:

dependabot.md
  -> shared/control.md
    -> shared/control-precompute.md

The lock file should contain the Precompute control facts step.

Actual behavior

The updated consumer workflow contained:
imports: []

The upstream workflow at the exact pinned source commit still contained the complete shared/control.md import.
The update completed successfully without reporting that the import had been removed.

A sibling workflow, optimization.md, updated from the same package and source commit retained the equivalent shared-control import and compiled correctly.

Suggested fix

The three-way update merge should preserve an import when:

  • The import exists in both the merge base and updated upstream workflow.
  • The consumer has not explicitly modified or removed it.
    The updater should also avoid silently replacing a non-empty upstream imports collection with [].
    A regression test should cover a prompt-body-only upstream change where nested frontmatter imports remain unchanged.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions