addPath function

void addPath({
  1. required String path,
})

Prepends inputPath to the PATH (for this action and future actions).

Implementation

void addPath({required String path}) {
  final filePath = environmentVariables['GITHUB_PATH'] ?? '';

  if (filePath.isNotEmpty) {
    issueFileCommand('PATH', path);
  } else {
    issueCommand('add-path', {}, path);
  }

  updateEnvironmentVariableCache(
    name: 'PATH',
    value: '$path${p.separator}${environmentVariables['PATH']}',
  );
}