From 764e8cd620d61ed6ca6d168cd06489e94d40b615 Mon Sep 17 00:00:00 2001 From: Daragh Date: Sun, 6 Jul 2025 23:28:51 +0000 Subject: [PATCH] Fix LFS on discord bot (#39) Reviewed-on: https://forgejo.skynet.ie/Skynet/discord-bot/pulls/39 Thanks @esy Co-authored-by: Daragh Co-committed-by: Daragh --- flake.nix | 1 + src/common/server_icon.rs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/flake.nix b/flake.nix index 1b39fbb..4494ace 100644 --- a/flake.nix +++ b/flake.nix @@ -221,6 +221,7 @@ after = ["network-online.target"]; wants = []; environment = environment_config; + path = with pkgs; [ git git-lfs ]; serviceConfig = { User = "${cfg.user}"; diff --git a/src/common/server_icon.rs b/src/common/server_icon.rs index abd0972..d99f265 100644 --- a/src/common/server_icon.rs +++ b/src/common/server_icon.rs @@ -191,6 +191,28 @@ pub mod update_icon { { dbg!(e); } + + if let Err(e) = Command::new("git") + // Install LFS for the repo + .arg("lfs") + .arg("install") + .current_dir(&folder) + .output() + { + dbg!(e); + } + + if let Err(e) = Command::new("git") + // clone the repo, gracefully "fails" + .arg("lfs") + .arg("pull") + .arg("origin") + .arg("main") + .current_dir(&folder) + .output() + { + dbg!(e); + } } fn get_logos(config: &Config, config_toml: &ConfigToml) -> Vec {