Skip to content

Commit

Permalink
chore(ci): fix sk passing
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Oct 24, 2024
1 parent cce0460 commit 7c69170
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
clean: false
- uses: actions/cache@v3
- uses: actions/cache@v4
id: cache
with:
path: |
Expand Down
30 changes: 18 additions & 12 deletions ua_generator/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,29 @@ fn bump_version_in_cargo_toml() -> Result<(), Box<dyn std::error::Error>> {
let cargo_toml_path = Path::new("Cargo.toml");

let mut cargo_toml_content = String::new();

crate::fs::OpenOptions::new()
.read(true)
.open(&cargo_toml_path)?
.read_to_string(&mut cargo_toml_content)?;

let mut parsed_toml: Value = cargo_toml_content.parse()?;
if let Some(version) = parsed_toml
.get_mut("package")
.and_then(|pkg| pkg.get_mut("version"))
{
if let Some(version_str) = version.as_str() {
let new_version = increment_version(version_str);
*version = Value::String(new_version.clone());
println!("Bumped version to: {}", new_version);
if !cargo_toml_content.is_empty() {
let mut parsed_toml: Value = cargo_toml_content.parse()?;

if let Some(version) = parsed_toml
.get_mut("package")
.and_then(|pkg| pkg.get_mut("version"))
{
if let Some(version_str) = version.as_str() {
let new_version = increment_version(version_str);
*version = Value::String(new_version.clone());
println!("Bumped version to: {}", new_version);
}
}
}

let new_cargo_toml_content = toml::to_string(&parsed_toml)?;
fs::write(cargo_toml_path, new_cargo_toml_content)?;
let new_cargo_toml_content = toml::to_string(&parsed_toml)?;
fs::write(cargo_toml_path, new_cargo_toml_content)?;
}

Ok(())
}
Expand All @@ -74,6 +78,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let build_enabled = env::var("BUILD_ENABLED").map(|v| v == "1").unwrap_or(false);

if build_enabled {
println!("generating user agents...");
let base_api =
env::var("API_URL").unwrap_or("https://api.spider.cloud/data/user_agents".into());

Expand Down Expand Up @@ -154,6 +159,7 @@ pub fn agents() -> [&'static str; 9] {{
let chrome_agent_list: Vec<ApiResult> =
match get(&format!("{base_api}?chrome=true&list=true"))
.set("apikey", &token)
.set("user-agent", "spider-rs")
.call()
{
Ok(req) => {
Expand Down

0 comments on commit 7c69170

Please sign in to comment.