Skip to content

Fix formatting of generated release notes #1738

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

Merged
merged 1 commit into from
Dec 7, 2022
Merged

Fix formatting of generated release notes #1738

merged 1 commit into from
Dec 7, 2022

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Dec 5, 2022

Motivation

The "Arduino IDE" GitHub Actions workflow generates a changelog from the commits since the last tag.

This changelog is published in multiple ways:

  • Printed to workflow run logs
  • Uploaded to Arduino's download server (mostly useful for the nightly builds)
  • Initial version of release notes

For the last, the changelog text must be passed from the dedicated changelog generation workflow step to the release step. This is done via a workflow job output.

At the time the system was set up, outputs for workflow run steps were set using the set-output workflow command. That "workflow command" system was later determined by GitHub to have potential security vulnerabilities, so it was replaced with a GITHUB_OUTPUT environment file.

The "Arduino IDE" workflow was migrated to the new "environment file" approach (#1604). It was later discovered that there was an undocumented breaking change in the method for handling multi-line strings in workflow step outputs between the old "workflow command" system and the new "environment file". This resulted in the initial release notes having an incorrect format. For example, what would previously have been formatted like this:

- Updated translation files (#1606) [23c7f5f]
- Use 0.29.0 CLI in IDE2 (#1683) [f1144ef]

Was now formatted like this:

- Updated translation files (#1606) [23c7f5f]%0A - Use 0.29.0 CLI in IDE2 (#1683) [f1144ef]%0A

Change description

The solution is to remove the commands that did the escaping of the changelog text in a manner that is no longer supported and replace them with the "here document"-style format supported for storing multiline strings in environment files.

A random number is used as the "delimiter" (limit string) per the security recommendations in the official GitHub documentation. Note that even though the multiline strings handling documentation was placed under the environment variable section of the documentation, it also applies to setting outputs.

Other information

Demonstration release in my fork using the updated workflow:

https://github.com/per1234/arduino-ide/releases/tag/2.0.3-rc.1

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

The "Arduino IDE" GitHub Actions workflow generates a changelog from the commits since the last tag.

This changelog is published in multiple ways:

- Printed to workflow run logs
- Uploaded to Arduino's download server (mostly useful for the nightly builds)
- Initial version of release notes

For the last, the changelog text must be passed from the dedicated changelog generation workflow step to the release
step. This is done via workflow job output.

At the time the system was set up, outputs for workflow `run` steps were set using the `set-output` workflow command.
That "workflow command" system was later determined by GitHub to have potential security vulnerabilities, so it was
replaced with a `GITHUB_OUTPUT` environment file.

The "Arduino IDE" workflow was migrated to the new "environment file" approach. It was later discovered that there was
an undocumented breaking change in the method for handling multi-line strings in workflow step outputs between the old
"workflow command" system and the new "environment file". This resulted in the initial release notes having an incorrect
format. For example, what would previously have been formatted like this:

- Updated translation files (#1606) [23c7f5f]
- Use 0.29.0 CLI in IDE2 (#1683) [f1144ef]

Was now formatted like this:

- Updated translation files (#1606) [23c7f5f]%0A - Use 0.29.0 CLI in IDE2 (#1683) [f1144ef]%0A

The solution is to remove the commands that did the escaping of the changelog text in a manner that is no longer
supported and replace them with a "here document"-style format.

A random number is used as the "delimiter" (limit string) per the security recommendations in the official GitHub
documentation. Note that even though the multiline strings handling documentation was placed under the environment
variable section, it also applies to setting outputs.
@per1234 per1234 added topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project labels Dec 5, 2022
@per1234 per1234 requested a review from AlbyIanna December 5, 2022 01:58
@per1234 per1234 self-assigned this Dec 5, 2022
@kittaakos kittaakos self-requested a review December 7, 2022 08:35
Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. Thank you so much for the example release to demonstrate the changes.

@per1234 per1234 merged commit 32f0426 into arduino:main Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants