You've already forked decomp.dev
mirror of
https://github.com/encounter/decomp.dev.git
synced 2026-03-30 11:06:20 -07:00
Add enable_pr_comments option to projects
This commit is contained in:
-20
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "\n INSERT INTO reports (project_id, version, git_commit, timestamp, data, data_version)\n VALUES (?, ?, ?, ?, ?, ?)\n ON CONFLICT (project_id, version COLLATE NOCASE, git_commit COLLATE NOCASE) DO UPDATE\n SET timestamp = EXCLUDED.timestamp\n RETURNING id\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Integer"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 6
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "40da4ebeb3450a8c78a890e359bcca067142cbc16805c73f186bca873a8e9c98"
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "\n INSERT INTO reports (project_id, version, git_commit, git_commit_message, timestamp, data, data_version)\n VALUES (?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (project_id, version COLLATE NOCASE, git_commit COLLATE NOCASE) DO UPDATE\n SET timestamp = EXCLUDED.timestamp\n RETURNING id\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Integer"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 7
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "92992242dd758ba9981b43e130684f92eacd4508f2162a77db4fdd0f8f30669f"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE projects ADD COLUMN enable_pr_comments BOOLEAN NOT NULL DEFAULT TRUE;
|
||||
+6
-2
@@ -362,7 +362,7 @@ impl Database {
|
||||
let mut conn = self.pool.acquire().await?;
|
||||
let project = match sqlx::query!(
|
||||
r#"
|
||||
SELECT id AS "id!", owner, repo, name, short_name, default_category, default_version, platform, workflow_id
|
||||
SELECT id AS "id!", owner, repo, name, short_name, default_category, default_version, platform, workflow_id, enable_pr_comments
|
||||
FROM projects
|
||||
WHERE owner = ? COLLATE NOCASE AND repo = ? COLLATE NOCASE
|
||||
"#,
|
||||
@@ -382,6 +382,7 @@ impl Database {
|
||||
default_version: row.default_version,
|
||||
platform: row.platform,
|
||||
workflow_id: row.workflow_id,
|
||||
enable_pr_comments: row.enable_pr_comments,
|
||||
},
|
||||
None => return Ok(None),
|
||||
};
|
||||
@@ -397,7 +398,7 @@ impl Database {
|
||||
let project_id_db = project_id as i64;
|
||||
let project = match sqlx::query!(
|
||||
r#"
|
||||
SELECT owner, repo, name, short_name, default_category, default_version, platform, workflow_id
|
||||
SELECT owner, repo, name, short_name, default_category, default_version, platform, workflow_id, enable_pr_comments
|
||||
FROM projects
|
||||
WHERE id = ?
|
||||
"#,
|
||||
@@ -416,6 +417,7 @@ impl Database {
|
||||
default_version: row.default_version,
|
||||
platform: row.platform,
|
||||
workflow_id: row.workflow_id,
|
||||
enable_pr_comments: row.enable_pr_comments,
|
||||
},
|
||||
None => return Ok(None),
|
||||
};
|
||||
@@ -548,6 +550,7 @@ impl Database {
|
||||
default_version,
|
||||
platform,
|
||||
workflow_id,
|
||||
enable_pr_comments AS "enable_pr_comments!",
|
||||
git_commit,
|
||||
git_commit_message,
|
||||
MAX(timestamp) AS "timestamp: time::OffsetDateTime",
|
||||
@@ -579,6 +582,7 @@ impl Database {
|
||||
default_version: row.default_version,
|
||||
platform: row.platform,
|
||||
workflow_id: row.workflow_id,
|
||||
enable_pr_comments: row.enable_pr_comments,
|
||||
},
|
||||
commit: match (row.git_commit, row.timestamp) {
|
||||
(Some(sha), Some(timestamp)) => Some(Commit {
|
||||
|
||||
@@ -208,6 +208,9 @@ async fn handle_workflow_run_completed(
|
||||
);
|
||||
}
|
||||
} else if workflow_run.event == "pull_request" {
|
||||
if !project_info.project.enable_pr_comments {
|
||||
return Ok(());
|
||||
}
|
||||
// Fetch any associated pull requests
|
||||
if pull_requests.is_empty() {
|
||||
let head = if let Some(head_owner) =
|
||||
|
||||
@@ -17,6 +17,7 @@ pub struct Project {
|
||||
pub default_version: Option<String>,
|
||||
pub platform: Option<String>,
|
||||
pub workflow_id: Option<String>,
|
||||
pub enable_pr_comments: bool,
|
||||
}
|
||||
|
||||
impl Project {
|
||||
|
||||
Reference in New Issue
Block a user