~sourcemage/wand

063bd0c75ad00a8b2801cacf1f2fd6544566beff — Vlad Glagolev 3 years ago 1886353 devel-sourcehut-automk
Auto-create non-existent repositories on SourceHut
1 files changed, 12 insertions(+), 1 deletions(-)

M remirror/remirror
M remirror/remirror => remirror/remirror +12 -1
@@ 360,7 360,18 @@ class ProviderSourceHut(Provider):
            raise requests.HTTPError(500)

        if data.get('repositoryByOwner') is None:
            raise requests.HTTPError(404)
            repo_mk = {'query': 'mutation CreateRepo($name: String!, $description: String, $visibility: Visibility!) { createRepository(name: $name, description: $description, visibility: $visibility) { name } }',
                       'variables': {'name': repo.name, 'visibility': 'public'.upper()}}

            req = self.http_call(graphql, repo_mk)

            req.raise_for_status()

            data = req.json()['data']

            # empty data equals server error
            if data is None or data.get('createRepository') is None:
                raise requests.HTTPError(500)


def mirror(conf):