psalm / shepherd

WIP - what runs on shepherd.dev
https://shepherd.dev
MIT License
68 stars 11 forks source link

query re: bitbucket / other repo providers #28

Open SignpostMarv opened 2 years ago

SignpostMarv commented 2 years ago

How feasible is it to add support for other repo providers to shepherd, either in a self-hosted context or a pr context?

paulshryock commented 1 year ago

I'd love to use Shepherd for repos hosted on BitBucket.

orklah commented 1 year ago

Not perfectly sure what you mean by that, but the host for shepherd can actually be changed: https://github.com/vimeo/psalm/blob/68d88c546b286a5fbdabe4728f6be9dd1db0dbe0/src/Psalm/Config.php#L541 through options or env variables: https://github.com/vimeo/psalm/blob/386aa27f4c0d54919528145833e7d460ec4dac84/src/Psalm/Internal/Cli/Psalm.php#L304

Aside from that, Shepherd is just a plugin at Psalm's level so you could build your own https://github.com/vimeo/psalm/blob/3e837cabd047e3508543378d291094826f0772e8/src/Psalm/Plugin/Shepherd.php#L37

SignpostMarv commented 1 year ago

@orklah only github is currently supported: https://github.com/psalm/shepherd/blob/c19f58c6a380883617cbb03d84775e868665b2e6/src/PsalmData.php#L19

        if (!empty($payload['build']['CI_REPO_OWNER'])
            && !empty($payload['build']['CI_REPO_NAME'])
            && empty($payload['build']['CI_PR_REPO_OWNER'])
            && empty($payload['build']['CI_PR_REPO_NAME'])
        ) {
            $repository = new Model\GithubRepository(
                $payload['build']['CI_REPO_OWNER'],
                $payload['build']['CI_REPO_NAME']
            );

            if (($payload['build']['CI_BRANCH'] ?? '') === GithubApi::fetchDefaultBranch($repository)) {
                /** @var string $date */
                $date = date('Y-m-d H:i:s', $payload['git']['head']['date'] ?? date('U'));
                GithubData::setRepositoryForMasterCommit($git_commit, $repository, $date);
            }
        }

        self::savePsalmData(
            $git_commit,
            $payload['issues'],
            $payload['coverage'][0],
            $payload['coverage'][1],
            $payload['level'] ?? null
        );