MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / create

Method create

api/integrations/github/views.py:165–186  ·  view source on GitHub ↗
(self, request, *args, **kwargs)

Source from the content-addressed store, hash-verified

163 raise ValidationError({"github_pk": ["Must be an integer"]})
164
165 def create(self, request, *args, **kwargs) -> Response | None: # type: ignore[no-untyped-def,return,override]
166 try:
167 response: Response = super().create(request, *args, **kwargs)
168 github_configuration: GithubConfiguration = GithubConfiguration.objects.get(
169 id=self.kwargs["github_pk"]
170 )
171 if request.data.get("tagging_enabled", False):
172 create_flagsmith_flag_label(
173 installation_id=github_configuration.installation_id,
174 owner=request.data.get("repository_owner"),
175 repo=request.data.get("repository_name"),
176 )
177 return response
178
179 except IntegrityError as e:
180 if re.search(
181 r"Key \(github_configuration_id, project_id, repository_owner, repository_name\)",
182 str(e),
183 ) and re.search(r"already exists.$", str(e)):
184 raise ValidationError(
185 detail="Duplication error. The GitHub repository already linked"
186 )
187
188 def update(self, request, *args, **kwargs) -> Response | None: # type: ignore[no-untyped-def,override]
189 response: Response = super().update(request, *args, **kwargs)

Callers 3

createMethod · 0.45
create_cleanup_issueFunction · 0.45

Calls 2

getMethod · 0.45

Tested by

no test coverage detected