public function download(Application $application, string $commit, string $targetFile): bool
    {
        $username = $application->parameter('gh.owner');
        $repository = $application->parameter('gh.repo');

        if (!$username || !$repository) {
            throw new VCSException(self::ERR_APP_MISCONFIGURED);
        }

        $endpoint = implode('/', [
            'repos',
            rawurlencode($username),
            rawurlencode($repository),
            'tarball',
            rawurlencode($commit),
        ]);

        $options = [
            'sink' => new LazyOpenStream($targetFile, 'w+'),
        ];

        try {
            $response = $this->guzzle->request('GET', $endpoint, $options);
        } catch (Exception $e) {
            throw new VCSException($e->getMessage(), $e->getCode(), $e);
        }

        return ($response->getStatusCode() === 200);
    }