Unverified Commit 027b2aba authored by Michael Daniels's avatar Michael Daniels Committed by GitHub
Browse files

lichess-bot: add updateScript, 2025.12.23.1 -> 2026.1.11.1 (#477980)

parents 3327b113 1c7e94b2
Loading
Loading
Loading
Loading
+38 −3
Original line number Diff line number Diff line
@@ -2,18 +2,23 @@
  lib,
  python3Packages,
  fetchFromGitHub,
  versionCheckHook,
  writeShellApplication,
  curl,
  jq,
  common-updater-scripts,
}:

python3Packages.buildPythonApplication {
  pname = "lichess-bot";
  version = "2025.12.23.1";
  version = "2026.1.11.1";
  pyproject = false;

  src = fetchFromGitHub {
    owner = "lichess-bot-devs";
    repo = "lichess-bot";
    rev = "6ea42dfaffa65efea0da09d94b058853d724a989";
    hash = "sha256-G8DiW96mRnvmmmRALRcYDnjLilQIRqH5m6+aTluhohI=";
    rev = "96afce91316ba1243290408f2eeb6cd89778e8ff";
    hash = "sha256-eE6b4VWhBqWjrF028om0NE/UN9+4sI7PoZp4eV6hRcE=";
  };

  propagatedBuildInputs = with python3Packages; [
@@ -43,6 +48,36 @@ python3Packages.buildPythonApplication {
    runHook postInstall
  '';

  nativeInstallCheckInputs = [
    versionCheckHook
  ];
  versionCheckProgramArg = "--disable_auto_logging";
  doInstallCheck = true;

  passthru = {
    updateScript = lib.getExe (writeShellApplication {
      name = "lichess-bot-update-script";

      runtimeInputs = [
        curl
        jq
        common-updater-scripts
      ];

      text = ''
        commit_msg='^Auto update version to (?<ver>[0-9.]+)$'
        commit="$(
          curl -s 'https://api.github.com/repos/lichess-bot-devs/lichess-bot/commits?path=lib/versioning.yml' | \
          jq -c "map(select(.commit.message | test(\"$commit_msg\"))) | first"
        )"
        rev="$(jq -r '.sha' <<< "$commit")"
        version="$(jq -r ".commit.message | capture(\"$commit_msg\") | .ver" <<< "$commit")"

        update-source-version lichess-bot "$version" --rev="$rev"
      '';
    });
  };

  meta = {
    description = "Bridge between lichess.org and bots";
    homepage = "https://github.com/lichess-bot-devs/lichess-bot";