Skip to content

changelog/submit: skip empty --existing-changelog-filename#152

Merged
cotti merged 1 commit into
mainfrom
fix/empty-existing-changelog-filename
May 13, 2026
Merged

changelog/submit: skip empty --existing-changelog-filename#152
cotti merged 1 commit into
mainfrom
fix/empty-existing-changelog-filename

Conversation

@cotti

@cotti cotti commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

When a PR has no previously-committed changelog file, the evaluate step output existing-changelog-filename is empty, and we were unconditionally forwarding --existing-changelog-filename "" to docs-builder changelog prepare-artifact.

docs-builder's ChangelogPrepareArtifactService treats "" as a real filename:

changelogFilename = input.ExistingChangelogFilename != null
    ? _fileSystem.Path.GetFileName(input.ExistingChangelogFilename)  // GetFileName("") == ""
    : _fileSystem.Path.GetFileName(sourceYaml);

var destYaml = _fileSystem.Path.Combine(input.OutputDir, changelogFilename);
// Path.Combine(".artifacts/changelog-artifact", "") == ".artifacts/changelog-artifact"
await _fileSystem.File.WriteAllTextAsync(destYaml, ...);

The write target ends up being the output directory path itself, and on Linux opening a directory for write returns EACCES:

Unhandled ChangelogPrepareArtifactService exception:
Access to the path '/home/runner/work/cloud/cloud/.artifacts/changelog-artifact' is denied.
System.IO.IOException: Permission denied
  at System.IO.File.OpenHandle(...)
  at System.IO.File.<WriteToFileAsync>...

This change only forwards --existing-changelog-filename when the value is non-empty. A complementary fix in elastic/docs-builder will treat "" as null inside the service so neither side relies on the other.

The regression became visible after docs-builder commit 0d6115b8 migrated the CLI from ConsoleAppFramework to Nullean.Argh, which no longer maps --flag "" to null.

Repro: elastic/cloud PR #154858 / run 25721575364.

Test plan

  • Re-run the failing job in elastic/cloud against this branch (or wait for the next changelog-bearing PR) and confirm prepare-artifact succeeds.
  • Sanity-check that supplying a real existing-changelog-filename (PR with a prior committed changelog) still works.

Made with Cursor

When a PR has no previously-committed changelog file, the evaluate step
output `existing-changelog-filename` is empty, and we were unconditionally
forwarding `--existing-changelog-filename ""` to `docs-builder changelog
prepare-artifact`.

docs-builder's prepare-artifact treats `""` as a real filename and
ends up calling `Path.Combine(outputDir, "") == outputDir`, then tries
to write the YAML at the output directory path itself, which fails on
Linux with EACCES ("Access to the path '...' is denied").

Only pass the flag when the value is non-empty. A complementary fix
in docs-builder will guard against the empty-string case as well.

Repro: elastic/cloud PR #154858 / run 25721575364
Co-authored-by: Cursor <cursoragent@cursor.com>
@cotti cotti requested a review from a team as a code owner May 13, 2026 15:21
@cotti cotti requested a review from technige May 13, 2026 15:21
@cotti cotti added the bug Something isn't working label May 13, 2026
@cotti cotti merged commit 2a1b58c into main May 13, 2026
3 of 4 checks passed
@cotti cotti deleted the fix/empty-existing-changelog-filename branch May 13, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants