exportVariable function Null safety

void exportVariable(
  1. String name,
  2. String value

Creates or updates an environment variable for any actions running NEXT in a job.

The current action does NOT have access to the new value, but all subsequent actions in a job will have access.

Environment variables are case-sensitive and you can include punctuation.


void exportVariable(String name, String value) {
  value = value.replaceAll('\n', '\\n');
  final file = Platform.environment['GITHUB_ENV'];
  if (file != null) {
    _appendToFile(file, '$name=$value');
  } else {
    _echo('set-env', value, {'name': name});