From f3aa0823603ef96e5d2f8f1e36c1a9a4320840fa Mon Sep 17 00:00:00 2001 From: devleejb Date: Thu, 29 Feb 2024 22:21:09 +0900 Subject: [PATCH 1/3] Apply clippy linter --- src/commands/search/mod.rs | 2 +- src/commands/set/key/mod.rs | 2 +- src/lib.rs | 2 +- src/main.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/search/mod.rs b/src/commands/search/mod.rs index 340c467..3f34143 100644 --- a/src/commands/search/mod.rs +++ b/src/commands/search/mod.rs @@ -32,7 +32,7 @@ pub fn few_shot_template(list: Vec<(String, String)>) -> ChatMessageCollection Result<(), Box> { - if !env::var("OPENAI_API_KEY").is_ok() { + if env::var("OPENAI_API_KEY").is_err() { println!("Please set your OpenAI API key using the `set key` command."); return Ok(()); } diff --git a/src/commands/set/key/mod.rs b/src/commands/set/key/mod.rs index ee3a201..07724dd 100644 --- a/src/commands/set/key/mod.rs +++ b/src/commands/set/key/mod.rs @@ -1,5 +1,5 @@ use clap::Parser; -use dirs; + use std::env; use std::fs::File; use std::io::prelude::*; diff --git a/src/lib.rs b/src/lib.rs index f76b67b..22be585 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ pub(crate) mod commands; use clap::Parser; use commands::{handle_command, Commands}; -use dirs; + use std::env; #[derive(Debug, Parser)] diff --git a/src/main.rs b/src/main.rs index 99ce57f..d5b83ff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ pub mod commands; use clap::Parser; use commands::{handle_command, Commands}; -use dirs; + use std::env; #[derive(Debug, Parser)] From 4861f028e73785ac6268d84dfcf2ceb29411bbd6 Mon Sep 17 00:00:00 2001 From: devleejb Date: Thu, 29 Feb 2024 22:26:08 +0900 Subject: [PATCH 2/3] Add CI workflows --- .github/workflows/ci.yml | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..34c94e0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,56 @@ +on: + pull_request: + branches: + - main + push: + branches: + - main + +name: Check and Lint + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: check + + fmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - run: rustup component add rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + override: true + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features + name: Clippy Output From b79a72507dab2ad205b6cdd086634f167d1c6e04 Mon Sep 17 00:00:00 2001 From: devleejb Date: Thu, 29 Feb 2024 22:26:23 +0900 Subject: [PATCH 3/3] Change token info --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6816c6a..a669a0e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,4 +29,4 @@ jobs: # [possible values: all, unix, windows, none] zip: windows # (required) GitHub token for uploading assets to GitHub Releases. - token: ${{ secrets.RELEASE_GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }}