Description
Description:
When reading the version from a file (specifically .tool-versions
in this case), an extra newline character is included in the step output. When using the output in subsequent steps - for instance, using the version output as part of a cache key - the newline character is included. While this doesn't break the caching step, including the newline character did cause issues with some automated tooling we were building around cache management.
Action version:
v3
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version:
node: 16.16.0
Repro steps:
I created a repo to repro the issue:
When looking at the actions run summary, one can see the additional \n
right after the version (v16.16.0
) in the cache keys.
Expected behavior:
The version output should be the exact version string with no additional whitespace.
Actual behavior:
The version output includes an additional newline character (\n
) in the output.
The fix seems to be adding a .trim()
here before returning the parsed version. I can create a PR if that path forward is acceptable.