Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing end-of-line character when writing to $GITHUB_OUTPUT #884

Closed
jcarnis opened this issue Apr 4, 2024 · 2 comments · Fixed by #885
Closed

missing end-of-line character when writing to $GITHUB_OUTPUT #884

jcarnis opened this issue Apr 4, 2024 · 2 comments · Fixed by #885
Assignees
Labels
bug Something isn't working properly released

Comments

@jcarnis
Copy link

jcarnis commented Apr 4, 2024

The problem

VersionGitHubActionsOutput.write_if_possible is writing to $GITHUB_OUTPUT, but fails to add an end-of line afterwards.

If one tries to echo another variable to $GITHUB_OUTPUT, it is then added to the previous line instead of a new line, and can't be used later in the workflow.

Here are the command from the workflow:
image

And the printed output:
image

Adding echo "" >> $GITHUB_OUTPUT before the next echo to $GITHUB_OUTPUT solved the issue as a workaround.

Expected behavior

Semantic release should write properly to $GITHUB_OUTPUT, finding out where the issue lies is time-consuming since this happens in the background.

Returning "\n".join(f"{key}={value!s}" for key, value in outputs.items()) + "\n" in VersionGitHubActionsOutput.to_output_text solves the issue.

Context

Linux runner
semantic release v9.3.1
Looking at the latest version, the issue seems still present.

@jcarnis jcarnis added the bug Something isn't working properly label Apr 4, 2024
@codejedi365
Copy link
Contributor

@jcarnis, thank you for the issue and fix action. If you have time to build a PR that would be great, otherwise I will try to get to it this weekend.

@codejedi365 codejedi365 self-assigned this Apr 6, 2024
@codejedi365 codejedi365 added this to the Improve GitHub Actions milestone Apr 6, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Apr 6, 2024
tests were adjusted for clarity and to replicate error detailed in python-semantic-release#884.
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Apr 6, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Apr 6, 2024
tests were adjusted for clarity and to replicate error detailed in python-semantic-release#884.
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Apr 6, 2024
codejedi365 added a commit that referenced this issue Apr 6, 2024
… format (#885)

* test(gh-actions-output): fix unit tests to manage proper whitespace

  tests were adjusted for clarity and to replicate error detailed in #884.

* fix(gh-actions-output): fixed trailing newline to match GITHUB_OUTPUT format

  Resolves: #884
@codejedi365
Copy link
Contributor

🎉 This issue has been resolved in version 9.4.1 🎉

The release is available on:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly released
Projects
None yet
2 participants