Skip to content

Commit 4d75fee

Browse files
Revert "feat(github): better GitHub app installation tracking" (#5355)
1 parent 937b45b commit 4d75fee

33 files changed

Lines changed: 972 additions & 1945 deletions

File tree

.sqlx/query-3e0f4214fbae78a344d4586f760c460aabf24e4707e9aa8e7259516f6cecf214.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-43bf593bf69fc1d4f0afdac8738096fc0c1b5ede2c495656d4d7912e55eaaa41.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-cacd042c1649e843312bfeb40093ebc2ae8fb2a14a0bc5841be3d09c1cb8b1a7.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.lock

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/web/src/lib/service-clients/service-storage/openapi.json

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
use super::DocumentStorageServiceClient;
2+
use anyhow::Result;
3+
4+
const ASSOCIATE_GITHUB_INSTALLATIONS_TIMEOUT: std::time::Duration =
5+
std::time::Duration::from_secs(15);
6+
7+
impl DocumentStorageServiceClient {
8+
/// Associates GitHub App installations installed by the given GitHub user
9+
/// with that user's Macro sources. Intended to be called after a github
10+
/// link is created for the user.
11+
#[tracing::instrument(skip(self))]
12+
pub async fn associate_github_installations(&self, github_user_id: &str) -> Result<()> {
13+
let res = self
14+
.client
15+
.post(format!(
16+
"{}/internal/github/installations/{}/associate",
17+
self.url, github_user_id
18+
))
19+
.timeout(ASSOCIATE_GITHUB_INSTALLATIONS_TIMEOUT)
20+
.send()
21+
.await?;
22+
23+
let status_code = res.status();
24+
25+
if status_code != reqwest::StatusCode::OK {
26+
let body: String = res.text().await?;
27+
tracing::error!(
28+
body=%body,
29+
status=%status_code,
30+
"unexpected response from document storage service"
31+
);
32+
anyhow::bail!(body);
33+
}
34+
35+
Ok(())
36+
}
37+
}

crates/document_storage_service_client/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub(crate) mod constants;
44
pub mod delete;
55
pub mod document;
66
pub mod error;
7+
pub mod github;
78
pub mod notification;
89
pub mod project;
910
pub mod thread;

crates/github/Cargo.toml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@ publish = false
55
version = "0.1.0"
66

77
[features]
8-
axum = [
9-
"dep:axum",
10-
"dep:axum-extra",
11-
"dep:entity_access",
12-
"dep:macro_authorization",
13-
"dep:model-error-response",
14-
"dep:utoipa",
15-
]
8+
axum = ["dep:axum", "dep:axum-extra", "dep:model-error-response", "dep:utoipa"]
169
default = ["axum", "inbound", "link", "outbound", "ports", "sync"]
1710
inbound = ["axum", "ports"]
1811
link = ["dep:entity_access", "dep:foreign_entity", "ports"]
@@ -39,13 +32,11 @@ sync = [
3932

4033
[dependencies]
4134
anyhow = { workspace = true }
42-
base64 = { workspace = true }
4335
chrono = { workspace = true }
4436
documents = { path = "../documents", default-features = false, features = [
4537
"ports",
4638
], optional = true }
4739
entity_access = { path = "../entity_access", default-features = false, features = [
48-
"inbound",
4940
"ports",
5041
], optional = true }
5142
foreign_entity = { path = "../foreign_entity", default-features = false, features = [
@@ -56,9 +47,6 @@ hmac = { workspace = true }
5647
jsonwebtoken = { workspace = true }
5748
macro_env = { path = "../macro_env" }
5849
macro_env_var = { path = "../macro_env_var" }
59-
macro_authorization = { path = "../macro_authorization", default-features = false, features = [
60-
"axum",
61-
], optional = true }
6250
macro_service_urls = { path = "../macro_service_urls" }
6351
model-entity = { path = "../model-entity", optional = true }
6452
model_notifications = { path = "../model_notifications", optional = true }
@@ -73,7 +61,6 @@ subtle = "2.6.1"
7361
thiserror = { workspace = true }
7462
tracing = { workspace = true }
7563
urlencoding = { workspace = true, optional = true }
76-
url = { workspace = true }
7764
uuid = { workspace = true }
7865

7966
fusionauth = { path = "../fusionauth", optional = true }
@@ -94,7 +81,6 @@ http-body-util = { workspace = true }
9481
macro_db_migrator = { path = "../macro_db_migrator" }
9582
mockall = { workspace = true }
9683
model = { path = "../model" }
97-
model_user = { path = "../model_user" }
9884
models_permissions = { path = "../models_permissions" }
9985
rootcause = { workspace = true }
10086
tokio = { workspace = true }

crates/github/src/domain/models/installation_state.rs

Lines changed: 0 additions & 112 deletions
This file was deleted.

0 commit comments

Comments
 (0)