Description
Describe the bug
When writing a single valid KEY=VALUE line to $GITHUB_ENV in a step, the file ends up with an additional unexpected None appended at the end.
This corrupts the env file, and the runner fails the step with:
Unable to process file command 'env' successfully.
Invalid format 'None'
The $GITHUB_ENV file starts empty at the beginning of the step.
We use either echo or a mv of a temp file to write image_tag=b845a92, and cat $GITHUB_ENV immediately after the write shows both:
image_tag=b845a92
None
The string None is not coming from our scripts — it seems added after our write but before the runner parses it.
To Reproduce
Steps to reproduce the behavior:
- Run this minimal job:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set image_tag
run: |
echo "GITHUB_ENV before:"
cat "$GITHUB_ENV" || echo "(empty)"
image_tag="b845a92"
tmp=$(mktemp)
echo "image_tag=$image_tag" > "$tmp"
mv "$tmp" "$GITHUB_ENV"
echo "GITHUB_ENV after:"
cat "$GITHUB_ENV"
- Observe the output of the final cat shows:
image_tag=b845a92
None
- The step then fails with:
Unable to process file command 'env' successfully.
Invalid format 'None'
Expected behavior
Only the valid image_tag=b845a92 should appear in $GITHUB_ENV after writing.
No additional None line should appear in the file.
The step should succeed.
Runner Version and Platform
Hosted runner on GitHub Actions (ubuntu-latest)
Likely runner version >= 2.316.0 (current hosted runner version at time of writing)
What's not working?
Writing to $GITHUB_ENV produces correct content (image_tag=b845a92) but the runner sees an additional None line and fails parsing it.
Job Log Output
GITHUB_ENV before:
(empty)
Resolved image tag: b845a92
GITHUB_ENV after:
image_tag=b845a92
None
Unable to process file command 'env' successfully.
Invalid format 'None'