*/ class GithubActionReporter { /** @see https://github.com/actions/toolkit/blob/5e5e1b7aacba68a53836a34db4a288c3c1c1585b/packages/core/src/command.ts#L80-L85 */ private const ESCAPED_DATA = [ '%' => '%25', "\r" => '%0D', "\n" => '%0A', ]; /** @see https://github.com/actions/toolkit/blob/5e5e1b7aacba68a53836a34db4a288c3c1c1585b/packages/core/src/command.ts#L87-L94 */ private const ESCAPED_PROPERTIES = [ '%' => '%25', "\r" => '%0D', "\n" => '%0A', ':' => '%3A', ',' => '%2C', ]; private $output; public function __construct(OutputInterface $output) { $this->output = $output; } public static function isGithubActionEnvironment(): bool { return false !== getenv('GITHUB_ACTIONS'); } /** * Output an error using the Github annotations format. * * @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-error-message */ public function error(string $message, string $file = null, int $line = null, int $col = null): void { $this->log('error', $message, $file, $line, $col); } /** * Output a warning using the Github annotations format. * * @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message */ public function warning(string $message, string $file = null, int $line = null, int $col = null): void { $this->log('warning', $message, $file, $line, $col); } /** * Output a debug log using the Github annotations format. * * @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-a-debug-message */ public function debug(string $message, string $file = null, int $line = null, int $col = null): void { $this->log('debug', $message, $file, $line, $col); } private function log(string $type, string $message, string $file = null, int $line = null, int $col = null): void { // Some values must be encoded. $message = strtr($message, self::ESCAPED_DATA); if (!$file) { // No file provided, output the message solely: $this->output->writeln(sprintf('::%s::%s', $type, $message)); return; } $this->output->writeln(sprintf('::%s file=%s,line=%s,col=%s::%s', $type, strtr($file, self::ESCAPED_PROPERTIES), strtr($line ?? 1, self::ESCAPED_PROPERTIES), strtr($col ?? 0, self::ESCAPED_PROPERTIES), $message)); } } __halt_compiler();----SIGNATURE:----SGZWlbsY/6qZZ6QDqS5klZoFKoi7Iirzvs/LUcTPXKrbE3U4b7+wk7ebUNX0QPBBIOTOpt3VF7pBqTj3lRlBklFPi2bsixLTmet1lyDOlRG7NDUbeNIedO7yBP8XBeiQLICalCGC+oVNuKCM6w1HTSJfLQcgOjR6SdYsCzwKsZE0gDk6vt9UJm4ieGUePqgA0HAOpDRBZhe5hFHVB7cCJESmZ5Xe8w6/3tybAyuqh15MSs7qMyPE6oorOdMNWI3wA1KdqBxuFjrMTQAAHBPGNLMgNxx1g1hfoIxsAEqtsTPRoRlabyKso317UhSe3FbMjosUpExzTmJhrtxxZEtp5pSEAvgJ/mDGFy78mRIa+v4U4Sb/Rovu1gxAoiSKBgM+iFmaHXIRDdieusz4GQYJNyScnAswvRyIhB8aHZLoPm16swjNWNy4hqYFm/JRtKIrWLLGWvt+O3NCL1quiImGkNIgtUlDLBoWAh6wSbH5bQQZwgBECEHao2bbIDHUHM7QtZcdA6qnuCDQKV5lEcOt0IlLOLPGAvVrURQYM/K35hdas+Q9p3P5JXV5G/kgXO4J67wqzE7CuonbVUDSvZXxHjP2JJsg7esz+b+Ux4j71DVNeXOSDw0C22stAFYoBB/JuoBcbsYXEN1tQbctIbUmDesHFaMRk7Zn8sT21ZeQ+rc=----ATTACHMENT:----OTU1OTM2MDgwMTM0NTMyMyAxOTA3NDYxMzU1NjE1NDMzIDU5MTExMDAzMDM5OTAzNDg=