in src/Utils/Actions/RunCsFixerCommand.php [175:202]
private function getJobFromWorkflowFile(string $repo, string $ref, string $workflowFile): ?array
{
$url = sprintf(
'https://raw.githubusercontent.com/%s/%s/.github/workflows/%s',
$repo,
$ref,
$workflowFile,
);
$response = $this->client->request('GET', $url);
if ($response->getStatusCode() === 404) {
throw new \Exception(sprintf(
'Failed to fetch the workflow file at "%s", maybe it doesn\'t exist? '
. 'Try supplying the "--workflow-file" option.',
$url
));
}
$workflow = Yaml::parse($response->getBody());
foreach ($workflow['jobs'] as $id => $job) {
if (str_contains($job['uses'] ?? '', '.github/workflows/code-standards.yml')) {
$job['name'] ??= $id;
$job['file'] = $workflowFile;
return $job;
}
}
return null;
}