diff --git a/.github/workflows/semver-checks.yml b/.github/workflows/semver-checks.yml index 340397e..9dffcc5 100644 --- a/.github/workflows/semver-checks.yml +++ b/.github/workflows/semver-checks.yml @@ -13,7 +13,7 @@ permissions: on: pull_request: - types: [review_requested, ready_for_review] + types: [opened, reopened, synchronize, ready_for_review] branches: - main paths-ignore: @@ -39,6 +39,9 @@ jobs: exit 1 fi cargo-semver-checks: + + + needs: check-branches permissions: pull-requests: write @@ -48,6 +51,13 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Delete old cargo-semver-checks comments + continue-on-error: true + run: | + gh pr view "${{ github.head_ref }}" --json comments --jq '.comments[] | select(.author.login == "github-actions") | .url' | grep -E 'issuecomment-(.+)' | cut -d '-' -f2 > comments.txt + xargs -I {} gh api -X DELETE "/repos/MAIF/yozefu/issues/comments/{}" < comments.txt + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: dtolnay/rust-toolchain@master with: toolchain: stable diff --git a/.gitignore b/.gitignore index 3870741..da88752 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/target +target .vscode **/*DS_Store akhq @@ -8,6 +8,7 @@ lol/rust/Cargo.lock semver-checks/ demo.sh ee.json +.github/ crates/**/*.cdx.xml crates/**/*.cdx.json diff --git a/compose.yml b/compose.yml index 26640d8..07c43b9 100644 --- a/compose.yml +++ b/compose.yml @@ -41,6 +41,13 @@ services: timeout: 1s retries: 10 + yozefu: + container_name: yozefu + build: + context: . + dockerfile: Dockerfile + restart: unless-stopped + akhq: container_name: yozefu-akhq image: tchiotludo/akhq diff --git a/crates/app/src/config.rs b/crates/app/src/config.rs index fa50894..020642c 100644 --- a/crates/app/src/config.rs +++ b/crates/app/src/config.rs @@ -112,11 +112,13 @@ fn default_show_shortcuts() -> bool { true } -impl Config { - pub fn new(path: &Path) -> Self { - Self { +impl TryFrom<&PathBuf> for Config { + type Error = Error; + + fn try_from(path: &PathBuf) -> Result { + Ok(Self { path: path.to_path_buf(), - yozefu_directory: PathBuf::default(), + yozefu_directory: Self::yozefu_directory()?, logs: None, default_url_template: default_url_template(), history: EXAMPLE_PROMPTS.iter().map(|e| e.to_string()).collect_vec(), @@ -126,9 +128,11 @@ impl Config { theme: default_theme(), show_shortcuts: true, export_directory: default_export_directory(), - } + }) } +} +impl Config { /// The default config file path pub fn path() -> Result { Self::yozefu_directory().map(|d| d.join("config.json")) diff --git a/crates/command/src/cli.rs b/crates/command/src/cli.rs index 2be2ed1..d0494ec 100644 --- a/crates/command/src/cli.rs +++ b/crates/command/src/cli.rs @@ -105,7 +105,7 @@ fn init_config_file() -> Result { if fs::metadata(&path).is_ok() { return Ok(path); } - let mut config = Config::new(&path); + let mut config = Config::try_from(&path)?; let mut localhost_config = IndexMap::new(); localhost_config.insert( "bootstrap.servers".to_string(),