Repository navigation
Description
Summary
When the 3-way merge of a workflow's source frontmatter during gh aw update produces conflicts, gh-aw does not report the conflict. It tries to parse the file containing the git conflict markers and fails with a misleading YAML error. The workflow is reported as "could not be updated" with a truncated reason.
The conflict also happens on a normal second update for an unmodified consumer. After a successful update gh-aw rewrites the local frontmatter into a normalized form. The next update then compares that normalized file against the original-format upstream base, so the line changed in the new release (imports: pin) conflicts.
Environment
- gh-aw version:
v0.92.0 - OS: Windows 11, Git Bash
- Workflow source: a package with
imports:and asource:frontmatter field, installed from a GitHub release - Update path:
gh aw update --cool-down 0, from releasev0.5.3tov0.5.4
Steps to reproduce
- Install a package whose
.mdworkflow stub has this upstream frontmatter (comments, indented list):imports: - owner/repo/workflows/[email protected]
- Run
gh aw updateto a newer release (v0.5.3). It succeeds, and gh-aw rewrites the local stub: comments dropped, keys sorted, quotes stripped, theimports:list unindented:imports: - owner/repo/workflows/[email protected]
- Publish a new release that only changes the pin to
@v0.5.4. - Run
gh aw update --cool-down 0again, without touching the local file.
Actual result
⚠ 8 workflow(s) could not be updated
│ aw-1, aw-2, aw-3, aw-4... │ unable to update source frontmatter: failed to parse frontmatter: failed to parse frontmatter: │
✗ workflow update failed
no workflows were successfully updated
Debug output (DEBUG='*' gh aw update my-aw --cool-down 0 --verbose):
update_merge Merge conflicts detected: exit_code=1
frontmatter_editor Failed to parse frontmatter:
[38:1] invalid header option: "|||||| base (original)"
38 | ||||||| base (original)
39 | - owner/repo/workflows/[email protected]
40 | =======
41 | - owner/repo/workflows/[email protected]
The merge conflicts on the imports: line: the base (original upstream format) and the local file (gh-aw-normalized format) both differ from the new upstream version at that line.
Expected result
- A merge conflict is reported as one, naming the workflow file and the conflicting lines, not as a YAML parse error.
- Ideally, an unmodified local stub does not conflict at all. Either gh-aw should not normalize the stored stub in a way that diverges from the upstream base, or the 3-way merge should compare normalized forms of all three versions.
- The summary table should not truncate the reason (the real cause is only visible with
DEBUG='*' --verbose).
Workaround
Before each update, reset every .md stub to the upstream stub of the installed tag (plus the source: line), so that the local file equals the merge base. After that, gh aw update reports Updated and compiled 1 workflow(s) with no conflict markers. The workaround has to be repeated for every release, because each successful update normalizes the stub again.
Related finding
The same error appears when the local .md stub has CRLF line endings (Windows, core.autocrlf=true). Every line then differs from the LF base, so the merge also conflicts everywhere. Adding .github/workflows/*.md text eol=lf to .gitattributes fixes only that part.
See also related issue: #73073
Activity