MCPcopy Create free account
hub / github.com/cachix/cloud.devenv.sh / create_from_webhook

Method create_from_webhook

backend/src/github/model.rs:170–199  ·  view source on GitHub ↗

Create or update a repo from webhook data

(
        conn: &mut diesel_async::AsyncPgConnection,
        repo_id: i64,
        name: String,
        is_private: bool,
        owner_id: i64,
    )

Source from the content-addressed store, hash-verified

168
169 /// Create or update a repo from webhook data
170 pub async fn create_from_webhook(
171 conn: &mut diesel_async::AsyncPgConnection,
172 repo_id: i64,
173 name: String,
174 is_private: bool,
175 owner_id: i64,
176 ) -> Result<Self> {
177 let repo = GitHubRepo {
178 id: repo_id,
179 name,
180 is_private,
181 owner_id,
182 disabled: false,
183 generate_pr: None,
184 };
185
186 let result = diesel::insert_into(github_repo::table)
187 .values(&repo)
188 .on_conflict(github_repo::id)
189 .do_update()
190 .set((
191 github_repo::name.eq(&repo.name),
192 github_repo::is_private.eq(repo.is_private),
193 github_repo::disabled.eq(false),
194 ))
195 .returning(GitHubRepo::as_returning())
196 .get_result(conn)
197 .await?;
198 Ok(result)
199 }
200
201 /// Mark a repo as disabled
202 pub async fn disable(conn: &mut diesel_async::AsyncPgConnection, repo_id: i64) -> Result<()> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected