From daf84309ffe7f76bbfff14a022cc5d431f3695cf Mon Sep 17 00:00:00 2001 From: Wreck-X Date: Tue, 2 Jul 2024 20:40:25 +0530 Subject: [PATCH 01/11] Add: Update mutation for attendance record --- src/db/attendance.rs | 1 + src/graphql/mutations.rs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/db/attendance.rs b/src/db/attendance.rs index 5f4b80d..724a42b 100644 --- a/src/db/attendance.rs +++ b/src/db/attendance.rs @@ -9,4 +9,5 @@ pub struct Attendance { pub date: NaiveDate, pub timein: NaiveTime, pub timeout: NaiveTime, + pub present: bool, } diff --git a/src/graphql/mutations.rs b/src/graphql/mutations.rs index 337fdd1..9661bf2 100644 --- a/src/graphql/mutations.rs +++ b/src/graphql/mutations.rs @@ -39,6 +39,7 @@ impl MutationRoot { Ok(member) } + //Mutation for adding Attendance to the Attendance table async fn add_attendance( &self, @@ -62,4 +63,25 @@ impl MutationRoot { Ok(attendance) } + + async fn update_attendance_present( + &self, + ctx: &Context<'_>, + id: i32, + date: NaiveDate, + present: bool, + ) -> Result { + let pool = ctx.data::>().expect("Pool not found in context"); + + let attendance = sqlx::query_as::<_, Attendance>( + "UPDATE Attendance SET present = $1 WHERE id = $2 AND date = $3 RETURNING *" + ) + .bind(present) + .bind(id) + .bind(date) + .fetch_one(pool.as_ref()) + .await?; + + Ok(attendance) + } } From 390e43f3415b7ed43754f969d784a13e5559078f Mon Sep 17 00:00:00 2001 From: Wreck-X Date: Tue, 13 Aug 2024 18:31:24 +0530 Subject: [PATCH 02/11] renames update_attendance_present to mark_attendance, fixes documentation issues --- migrations/20240711150547_add_mac.sql | 1 + .../20240813125650_rename_present_to_ispresent.sql | 1 + .../20240813130838_rename_present_to_isPresent.sql | 1 + src/db/attendance.rs | 2 +- src/graphql/mutations.rs | 10 +++++----- src/graphql/query.rs | 4 ++-- 6 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 migrations/20240711150547_add_mac.sql create mode 100644 migrations/20240813125650_rename_present_to_ispresent.sql create mode 100644 migrations/20240813130838_rename_present_to_isPresent.sql diff --git a/migrations/20240711150547_add_mac.sql b/migrations/20240711150547_add_mac.sql new file mode 100644 index 0000000..3808373 --- /dev/null +++ b/migrations/20240711150547_add_mac.sql @@ -0,0 +1 @@ +ALTER TABLE Member ADD COLUMN macaddress TEXT; \ No newline at end of file diff --git a/migrations/20240813125650_rename_present_to_ispresent.sql b/migrations/20240813125650_rename_present_to_ispresent.sql new file mode 100644 index 0000000..79aab75 --- /dev/null +++ b/migrations/20240813125650_rename_present_to_ispresent.sql @@ -0,0 +1 @@ +ALTER TABLE Attendance RENAME COLUMN present TO ispresent; diff --git a/migrations/20240813130838_rename_present_to_isPresent.sql b/migrations/20240813130838_rename_present_to_isPresent.sql new file mode 100644 index 0000000..4c2936f --- /dev/null +++ b/migrations/20240813130838_rename_present_to_isPresent.sql @@ -0,0 +1 @@ +ALTER TABLE Attendance RENAME COLUMN ispresent TO is_present; diff --git a/src/db/attendance.rs b/src/db/attendance.rs index 724a42b..5ba3a3f 100644 --- a/src/db/attendance.rs +++ b/src/db/attendance.rs @@ -9,5 +9,5 @@ pub struct Attendance { pub date: NaiveDate, pub timein: NaiveTime, pub timeout: NaiveTime, - pub present: bool, + pub is_present: bool, } diff --git a/src/graphql/mutations.rs b/src/graphql/mutations.rs index 9661bf2..d001672 100644 --- a/src/graphql/mutations.rs +++ b/src/graphql/mutations.rs @@ -40,7 +40,7 @@ impl MutationRoot { } - //Mutation for adding Attendance to the Attendance table + //Mutation for adding attendance to the Attendance table async fn add_attendance( &self, ctx: &Context<'_>, @@ -64,19 +64,19 @@ impl MutationRoot { Ok(attendance) } - async fn update_attendance_present( + async fn mark_attendance( &self, ctx: &Context<'_>, id: i32, date: NaiveDate, - present: bool, + is_present: bool, ) -> Result { let pool = ctx.data::>().expect("Pool not found in context"); let attendance = sqlx::query_as::<_, Attendance>( - "UPDATE Attendance SET present = $1 WHERE id = $2 AND date = $3 RETURNING *" + "UPDATE Attendance SET is_present = $1 WHERE id = $2 AND date = $3 RETURNING *" ) - .bind(present) + .bind(is_present) .bind(id) .bind(date) .fetch_one(pool.as_ref()) diff --git a/src/graphql/query.rs b/src/graphql/query.rs index c249783..d8ebfb7 100644 --- a/src/graphql/query.rs +++ b/src/graphql/query.rs @@ -11,7 +11,7 @@ pub struct QueryRoot; #[Object] impl QueryRoot { - //Query for retrieving the Members + //Query for retrieving the members async fn get_member(&self, ctx: &Context<'_>) -> Result, sqlx::Error> { let pool = ctx.data::>().expect("Pool not found in context"); let users = sqlx::query_as::<_, Member>("SELECT * FROM Member") @@ -20,7 +20,7 @@ impl QueryRoot { Ok(users) } - //Query for retrieving the Attendance based on date + //Query for retrieving the attendance based on date async fn get_attendance( &self, ctx: &Context<'_>, From 453bdd4496448ef4591f7511f4f6613ca1049c16 Mon Sep 17 00:00:00 2001 From: Wreck-X Date: Wed, 14 Aug 2024 15:59:21 +0530 Subject: [PATCH 03/11] add-macaddress-field-to-members-table --- migrations/20240813130838_rename_present_to_isPresent.sql | 2 +- migrations/20240813132052_rename_present_to_is_present.sql | 2 +- src/db/member.rs | 1 + src/graphql/mutations.rs | 6 ++++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/migrations/20240813130838_rename_present_to_isPresent.sql b/migrations/20240813130838_rename_present_to_isPresent.sql index 4c2936f..06284bc 100644 --- a/migrations/20240813130838_rename_present_to_isPresent.sql +++ b/migrations/20240813130838_rename_present_to_isPresent.sql @@ -1 +1 @@ -ALTER TABLE Attendance RENAME COLUMN ispresent TO is_present; +ALTER TABLE Attendance RENAME COLUMN ispresent TO is_prresent; diff --git a/migrations/20240813132052_rename_present_to_is_present.sql b/migrations/20240813132052_rename_present_to_is_present.sql index 4c2936f..8b13789 100644 --- a/migrations/20240813132052_rename_present_to_is_present.sql +++ b/migrations/20240813132052_rename_present_to_is_present.sql @@ -1 +1 @@ -ALTER TABLE Attendance RENAME COLUMN ispresent TO is_present; + diff --git a/src/db/member.rs b/src/db/member.rs index 3d3b16b..52970f1 100644 --- a/src/db/member.rs +++ b/src/db/member.rs @@ -13,4 +13,5 @@ pub struct Member { pub email: String, pub sex: String, pub year: i32, + pub macaddress: String, } diff --git a/src/graphql/mutations.rs b/src/graphql/mutations.rs index d001672..db8d3d5 100644 --- a/src/graphql/mutations.rs +++ b/src/graphql/mutations.rs @@ -20,12 +20,13 @@ impl MutationRoot { hostel: String, email: String, sex: String, - year: i32 + year: i32, + macaddress: String, ) -> Result { let pool = ctx.data::>().expect("Pool not found in context"); let member = sqlx::query_as::<_, Member>( - "INSERT INTO Member (rollno, name, hostel, email, sex, year) VALUES ($1, $2, $3, $4, $5, $6) RETURNING *" + "INSERT INTO Member (rollno, name, hostel, email, sex, year, macaddress) VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING *" ) .bind(rollno) .bind(name) @@ -33,6 +34,7 @@ impl MutationRoot { .bind(email) .bind(sex) .bind(year) + .bind(macaddress) .fetch_one(pool.as_ref()) .await?; From b7b089ccc9a2402d7853c3d8c6b395e2faeca3f7 Mon Sep 17 00:00:00 2001 From: Wreck-X Date: Wed, 14 Aug 2024 19:15:02 +0530 Subject: [PATCH 04/11] fix: is_present not present in attendance table due to a typo --- migrations/20240813131821_rename_present_to_isPresent.sql | 1 + migrations/20240813132052_rename_present_to_is_present.sql | 1 - src/graphql/mutations.rs | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 migrations/20240813131821_rename_present_to_isPresent.sql delete mode 100644 migrations/20240813132052_rename_present_to_is_present.sql diff --git a/migrations/20240813131821_rename_present_to_isPresent.sql b/migrations/20240813131821_rename_present_to_isPresent.sql new file mode 100644 index 0000000..6e2ff32 --- /dev/null +++ b/migrations/20240813131821_rename_present_to_isPresent.sql @@ -0,0 +1 @@ +ALTER TABLE Attendance RENAME COLUMN is_prresent TO is_present; diff --git a/migrations/20240813132052_rename_present_to_is_present.sql b/migrations/20240813132052_rename_present_to_is_present.sql deleted file mode 100644 index 8b13789..0000000 --- a/migrations/20240813132052_rename_present_to_is_present.sql +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/graphql/mutations.rs b/src/graphql/mutations.rs index db8d3d5..ba9ad2d 100644 --- a/src/graphql/mutations.rs +++ b/src/graphql/mutations.rs @@ -50,16 +50,18 @@ impl MutationRoot { date: NaiveDate, timein: NaiveTime, timeout: NaiveTime, + is_present: bool, ) -> Result { let pool = ctx.data::>().expect("Pool not found in context"); let attendance = sqlx::query_as::<_, Attendance>( - "INSERT INTO Attendance (id, date, timein, timeout) VALUES ($1, $2, $3, $4) RETURNING *" + "INSERT INTO Attendance (id, date, timein, timeout, is_present) VALUES ($1, $2, $3, $4, $5) RETURNING *" ) .bind(id) .bind(date) .bind(timein) .bind(timeout) + .bind(is_present) .fetch_one(pool.as_ref()) .await?; From 71af9357d91672e44880b16dca2fa6a31a03fa72 Mon Sep 17 00:00:00 2001 From: Wreck-X Date: Sat, 24 Aug 2024 19:35:42 +0530 Subject: [PATCH 05/11] add: Secret verification using sha2 and hmac --- Cargo.lock | 1 + Cargo.toml | 2 ++ src/graphql/mutations.rs | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index bf74805..9d94866 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1919,6 +1919,7 @@ dependencies = [ "async-graphql-axum", "axum 0.7.5", "chrono", + "hmac", "serde", "shuttle-axum", "shuttle-runtime", diff --git a/Cargo.toml b/Cargo.toml index d663a29..7132b78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,3 +14,5 @@ shuttle-runtime = "0.46.0" shuttle-shared-db = { version = "0.46.0", features = ["postgres", "sqlx"] } sqlx = { version = "0.7.1", features = ["chrono"] } tokio = "1.28.2" +hmac = "0.12.1" +sha = "0.10.8" \ No newline at end of file diff --git a/src/graphql/mutations.rs b/src/graphql/mutations.rs index ba9ad2d..6be8701 100644 --- a/src/graphql/mutations.rs +++ b/src/graphql/mutations.rs @@ -3,6 +3,10 @@ use chrono::{NaiveDate, NaiveTime}; use sqlx::PgPool; use sqlx::types::chrono; use std::sync::Arc; +use hmac::{Hmac,Mac}; +use sha2::Sha256; + +type HmacSha256 = Hmac; use crate::db::{member::Member, attendance::Attendance}; @@ -22,9 +26,12 @@ impl MutationRoot { sex: String, year: i32, macaddress: String, + ) -> Result { let pool = ctx.data::>().expect("Pool not found in context"); + + let member = sqlx::query_as::<_, Member>( "INSERT INTO Member (rollno, name, hostel, email, sex, year, macaddress) VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING *" ) @@ -51,12 +58,31 @@ impl MutationRoot { timein: NaiveTime, timeout: NaiveTime, is_present: bool, + hmac_signature: String, ) -> Result { let pool = ctx.data::>().expect("Pool not found in context"); + let config = Config::from_file("Secrets.toml").expect("Failed to load config"); + let secret_key = config.secret_key; + + let mut mac = HmacSha256::new_from_slice(secret_key.as_bytes()) + .expect("HMAC can take key of any size"); + + let expected_signature = mac. finalize().into_bytes(); + + // Convert the received HMAC signature from the client to bytes for comparison + let received_signature = hex::decode(hmac_signature) + .map_err(|_| sqlx::Error::Protocol("Invalid HMAC signature".into()))?; + + // Check if the signatures match + if expected_signature.as_slice() != received_signature.as_slice() { + return Err(sqlx::Error::Protocol("HMAC verification failed".into())); + } + let attendance = sqlx::query_as::<_, Attendance>( "INSERT INTO Attendance (id, date, timein, timeout, is_present) VALUES ($1, $2, $3, $4, $5) RETURNING *" ) + .bind(id) .bind(date) .bind(timein) From f51b4dfe60f8b6917d06546de43ed46510d03a39 Mon Sep 17 00:00:00 2001 From: Wreck-X Date: Sat, 24 Aug 2024 21:05:00 +0530 Subject: [PATCH 06/11] fix: fetching secrets from Secrets.toml --- Cargo.lock | 2 ++ Cargo.toml | 3 ++- src/graphql/mutations.rs | 55 +++++++++++++++++++++++++++------------- src/main.rs | 13 ++++++---- 4 files changed, 49 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9d94866..3051460 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1919,8 +1919,10 @@ dependencies = [ "async-graphql-axum", "axum 0.7.5", "chrono", + "hex", "hmac", "serde", + "sha2", "shuttle-axum", "shuttle-runtime", "shuttle-shared-db", diff --git a/Cargo.toml b/Cargo.toml index 7132b78..ca5dcaf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,4 +15,5 @@ shuttle-shared-db = { version = "0.46.0", features = ["postgres", "sqlx"] } sqlx = { version = "0.7.1", features = ["chrono"] } tokio = "1.28.2" hmac = "0.12.1" -sha = "0.10.8" \ No newline at end of file +sha2 = "0.10.8" +hex = "0.4.3" \ No newline at end of file diff --git a/src/graphql/mutations.rs b/src/graphql/mutations.rs index 6be8701..4085fee 100644 --- a/src/graphql/mutations.rs +++ b/src/graphql/mutations.rs @@ -6,6 +6,7 @@ use std::sync::Arc; use hmac::{Hmac,Mac}; use sha2::Sha256; + type HmacSha256 = Hmac; use crate::db::{member::Member, attendance::Attendance}; @@ -51,33 +52,19 @@ impl MutationRoot { //Mutation for adding attendance to the Attendance table async fn add_attendance( + &self, + ctx: &Context<'_>, id: i32, date: NaiveDate, timein: NaiveTime, timeout: NaiveTime, is_present: bool, - hmac_signature: String, + ) -> Result { let pool = ctx.data::>().expect("Pool not found in context"); - let config = Config::from_file("Secrets.toml").expect("Failed to load config"); - let secret_key = config.secret_key; - - let mut mac = HmacSha256::new_from_slice(secret_key.as_bytes()) - .expect("HMAC can take key of any size"); - - let expected_signature = mac. finalize().into_bytes(); - - // Convert the received HMAC signature from the client to bytes for comparison - let received_signature = hex::decode(hmac_signature) - .map_err(|_| sqlx::Error::Protocol("Invalid HMAC signature".into()))?; - - // Check if the signatures match - if expected_signature.as_slice() != received_signature.as_slice() { - return Err(sqlx::Error::Protocol("HMAC verification failed".into())); - } let attendance = sqlx::query_as::<_, Attendance>( "INSERT INTO Attendance (id, date, timein, timeout, is_present) VALUES ($1, $2, $3, $4, $5) RETURNING *" @@ -100,15 +87,47 @@ impl MutationRoot { id: i32, date: NaiveDate, is_present: bool, + hmac_signature: String, ) -> Result { + let pool = ctx.data::>().expect("Pool not found in context"); + let secret_key = ctx.data::().expect("HMAC secret not found in context"); + println!("{}",secret_key); + let mut mac = HmacSha256::new_from_slice(secret_key.as_bytes()).expect("HMAC can take key of any size"); + + let message = format!("{}{}{}", id, date, is_present); + mac.update(message.as_bytes()); + + println!("{}", message); + let expected_signature = mac.finalize().into_bytes(); + + println!("Trying"); + // Convert the received HMAC signature from the client to bytes for comparison + let received_signature = hex::decode(hmac_signature) + .map_err(|_| sqlx::Error::Protocol("Invalid HMAC signature".into()))?; + + println!("Expected Signature: {:?}", expected_signature); + println!("Received Signature: {:?}", received_signature); + // Check if the signatures match + if expected_signature.as_slice() != received_signature.as_slice() { + + return Err(sqlx::Error::Protocol("HMAC verification failed".into())); + } + println!("Success"); + + + + let attendance = sqlx::query_as::<_, Attendance>( "UPDATE Attendance SET is_present = $1 WHERE id = $2 AND date = $3 RETURNING *" ) + + .bind(is_present) .bind(id) - .bind(date) + .bind(date) + .bind(is_present) .fetch_one(pool.as_ref()) .await?; diff --git a/src/main.rs b/src/main.rs index c9fa020..2040367 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,16 @@ use std::{env, sync::Arc}; use tokio::task; -use tokio::time::{sleep, sleep_until, Instant}; +use tokio::time::{ sleep_until, Instant}; use std::time::Duration; use async_graphql_axum::GraphQL; use axum::{routing::get, Router}; use chrono::{ Local, NaiveTime}; -use db::attendance::Attendance; + use db::member::Member; use sqlx::PgPool; use async_graphql::{ Schema, EmptySubscription}; - +use shuttle_runtime::SecretStore; use crate::graphql::mutations::MutationRoot; use crate::graphql::query::QueryRoot; use crate::routes::graphiql; @@ -22,21 +22,24 @@ mod routes; #[derive(Clone)] struct MyState { pool: Arc, + secret_key: String, } //Main method #[shuttle_runtime::main] -async fn main(#[shuttle_shared_db::Postgres] pool: PgPool) -> shuttle_axum::ShuttleAxum { +async fn main(#[shuttle_shared_db::Postgres] pool: PgPool,#[shuttle_runtime::Secrets] secrets: SecretStore,) -> shuttle_axum::ShuttleAxum { env::set_var("PGOPTIONS", "-c ignore_version=true"); sqlx::migrate!().run(&pool).await.expect("Failed to run migrations"); let pool = Arc::new(pool); + let secret_key = secrets.get("ROOT_SECRET").expect("ROOT_SECRET not found"); let schema = Schema::build(QueryRoot, MutationRoot, EmptySubscription) .data(pool.clone()) + .data(secret_key.clone()) // .finish(); - let state = MyState { pool: pool.clone() }; + let state = MyState { pool: pool.clone() , secret_key: secret_key.clone()}; let router = Router::new() .route("/", get(graphiql).post_service(GraphQL::new(schema.clone()))) From 385b91f7095aeca7b4413f21ce3af43ab5f8a09a Mon Sep 17 00:00:00 2001 From: 2205u Date: Tue, 25 Jun 2024 01:45:18 +0530 Subject: [PATCH 07/11] workflow: add shuttle-run action for PRs --- .github/workflows/shuttle-run.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/shuttle-run.yml b/.github/workflows/shuttle-run.yml index 5141a0d..d0597d6 100644 --- a/.github/workflows/shuttle-run.yml +++ b/.github/workflows/shuttle-run.yml @@ -12,3 +12,4 @@ jobs: - name: Run shuttle project locally. uses: ivinjabraham/shuttle-run@v1.1 +S \ No newline at end of file From c2fcf1f68b698bcea51d48c927470940ec76e371 Mon Sep 17 00:00:00 2001 From: Ivin Date: Sat, 29 Jun 2024 19:51:16 +0530 Subject: [PATCH 08/11] workflow: update shuttle-run to v1.1 --- .github/workflows/shuttle-run.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/shuttle-run.yml b/.github/workflows/shuttle-run.yml index d0597d6..ed73919 100644 --- a/.github/workflows/shuttle-run.yml +++ b/.github/workflows/shuttle-run.yml @@ -11,5 +11,4 @@ jobs: uses: actions/checkout@v4 - name: Run shuttle project locally. - uses: ivinjabraham/shuttle-run@v1.1 -S \ No newline at end of file + uses: ivinjabraham/shuttle-run@v1.0 From 13aadaaaf1655655680b1c7b10dace4a8782b6f6 Mon Sep 17 00:00:00 2001 From: Wreck Date: Thu, 29 Aug 2024 17:17:24 +0530 Subject: [PATCH 09/11] add: time-in time-out calculations --- src/graphql/mutations.rs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/graphql/mutations.rs b/src/graphql/mutations.rs index 4085fee..ea3f032 100644 --- a/src/graphql/mutations.rs +++ b/src/graphql/mutations.rs @@ -1,4 +1,5 @@ use async_graphql::{Context, Object}; +use ::chrono::Local; use chrono::{NaiveDate, NaiveTime}; use sqlx::PgPool; use sqlx::types::chrono; @@ -93,43 +94,47 @@ impl MutationRoot { let pool = ctx.data::>().expect("Pool not found in context"); let secret_key = ctx.data::().expect("HMAC secret not found in context"); - println!("{}",secret_key); + let mut mac = HmacSha256::new_from_slice(secret_key.as_bytes()).expect("HMAC can take key of any size"); let message = format!("{}{}{}", id, date, is_present); mac.update(message.as_bytes()); - println!("{}", message); let expected_signature = mac.finalize().into_bytes(); - println!("Trying"); + // Convert the received HMAC signature from the client to bytes for comparison let received_signature = hex::decode(hmac_signature) .map_err(|_| sqlx::Error::Protocol("Invalid HMAC signature".into()))?; - println!("Expected Signature: {:?}", expected_signature); - println!("Received Signature: {:?}", received_signature); - // Check if the signatures match + if expected_signature.as_slice() != received_signature.as_slice() { return Err(sqlx::Error::Protocol("HMAC verification failed".into())); } - println!("Success"); + let current_time = Local::now().time(); + let attendance = sqlx::query_as::<_, Attendance>( - "UPDATE Attendance SET is_present = $1 WHERE id = $2 AND date = $3 RETURNING *" + " + UPDATE Attendance + SET + timein = CASE WHEN timein = '00:00:00' THEN $1 ELSE timein END, + timeout = $1, + is_present = $2 + WHERE id = $3 AND date = $4 + RETURNING * + " ) - - + .bind(current_time) .bind(is_present) .bind(id) .bind(date) - .bind(is_present) .fetch_one(pool.as_ref()) - .await?; + .await?; Ok(attendance) } From 9a41467974f8ff4d77245b82215baacb36cf36f6 Mon Sep 17 00:00:00 2001 From: Ivin Date: Fri, 27 Sep 2024 00:23:21 +0530 Subject: [PATCH 10/11] add root_secret to workflow --- .github/workflows/shuttle-run.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/shuttle-run.yml b/.github/workflows/shuttle-run.yml index 5141a0d..d38a7c5 100644 --- a/.github/workflows/shuttle-run.yml +++ b/.github/workflows/shuttle-run.yml @@ -12,3 +12,6 @@ jobs: - name: Run shuttle project locally. uses: ivinjabraham/shuttle-run@v1.1 + with: + secrets: | + ROOT_SECRET = '${{ secrets.ROOT_SECRET }}' From 92eab6a063644a88f45c0011435b44d834ff3a72 Mon Sep 17 00:00:00 2001 From: Ivin Date: Fri, 27 Sep 2024 17:05:39 +0530 Subject: [PATCH 11/11] add root_secret to deploy workflow --- .github/workflows/deploy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c2bac1c..6da7996 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,5 +12,7 @@ jobs: steps: - uses: shuttle-hq/deploy-action@main with: - deploy-key: ${{ secrets.SHUTTLE_API_KEY }} name: "root" + deploy-key: ${{ secrets.SHUTTLE_API_KEY }} + secrets: | + ROOT_SECRET = '${{ secrets.ROOT_SECRET }}'