Skip to content

Commit 563b86d

Browse files
committed
feat: Small updates and fixes
1 parent 449919a commit 563b86d

File tree

4 files changed

+60
-40
lines changed

4 files changed

+60
-40
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ glob = "0.3"
2525
ghactions = { version = "^0.16", features = ["dotenvy", "log", "generate", "octocrab", "toolcache-all"] }
2626
ghactions-core = { version = "^0.16" }
2727

28-
ghastoolkit = { version = "^0.9.1", features = ["toolcache"] }
28+
ghastoolkit = { version = "^0.10", features = ["toolcache"] }
2929

3030
# GitHub API
3131
octocrab = "^0.44"

src/action.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::path::PathBuf;
44
use anyhow::{Context, Result};
55
use ghactions::prelude::*;
66
use ghactions_core::repository::reference::RepositoryReference as Repository;
7-
use ghastoolkit::{CodeQL, codeql::CodeQLLanguage};
7+
use ghastoolkit::{CodeQL, CodeQLPack, codeql::CodeQLLanguage};
88

99
pub const BANNER: &str = r#" ___ _ ____ __ __ _ _ _
1010
/ __\___ __| | ___ /___ \/ / /__\_ _| |_ /_\ ___| |_
@@ -89,7 +89,7 @@ pub struct Action {
8989
version: String,
9090

9191
/// Path to the extractor
92-
#[output(description = "Path to the extractor")]
92+
#[output(description = "Path to the extractor", rename = "extractor-path")]
9393
extractor_path: String,
9494
}
9595

@@ -172,12 +172,22 @@ impl Action {
172172
pub async fn install_packs(&self, codeql: &CodeQL) -> Result<()> {
173173
log::info!("Installing CodeQL Packs");
174174
for pack in &self.packs {
175-
log::info!("Installing pack `{pack}`");
176-
177-
codeql
178-
.run(vec!["pack", "download", pack])
179-
.await
180-
.context(format!("Failed to download pack `{pack}`"))?;
175+
log::debug!("Installing pack `{pack}`");
176+
177+
let qlpack = CodeQLPack::try_from(pack.clone())?;
178+
log::info!("QLPack :: {qlpack:?}");
179+
180+
if pack.starts_with("./") {
181+
qlpack
182+
.install(codeql)
183+
.await
184+
.context(format!("Failed to install pack `{pack}`"))?;
185+
} else {
186+
qlpack
187+
.download(codeql)
188+
.await
189+
.context(format!("Failed to download pack `{pack}`"))?;
190+
}
181191
}
182192
Ok(())
183193
}

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ async fn main() -> Result<()> {
3030
.build()
3131
.await
3232
.context("Failed to create CodeQL instance")?;
33+
log::debug!("CodeQL :: {codeql:?}");
3334

3435
if !codeql.is_installed().await {
3536
let codeql_version = action.codeql_version();

0 commit comments

Comments
 (0)