diff --git a/.gitignore b/.gitignore index e0d5b33..476ae69 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ secrets.auto.tfvars.json # nix .direnv result* +.pre-commit-config.yaml diff --git a/flake.lock b/flake.lock index f6f65b4..93b7749 100644 --- a/flake.lock +++ b/flake.lock @@ -2,6 +2,7 @@ "nodes": { "clan-core": { "inputs": { + "disko": "disko", "flake-parts": [ "flake-parts" ], @@ -9,16 +10,17 @@ "nixpkgs": [ "nixpkgs" ], + "pre-commit-hooks-nix": "pre-commit-hooks-nix", "treefmt-nix": [ "treefmt-nix" ] }, "locked": { - "lastModified": 1690550960, - "narHash": "sha256-448deP14rAvl1Uen/ciInXZ7eCNRC7L/3gyBlaiM0O8=", + "lastModified": 1690561299, + "narHash": "sha256-D1JBtv01IXPFwjDvx++sfJhGm1MLTtS6ZFzIIDDgYXg=", "ref": "refs/heads/main", - "rev": "ea8f7f83d64e554af28634beb153b34b130e5292", - "revCount": 140, + "rev": "626603079733d87339e9f8cbe9faee59ff7b4e6d", + "revCount": 154, "type": "git", "url": "https://git.clan.lol/clan/clan-core" }, @@ -28,6 +30,27 @@ } }, "disko": { + "inputs": { + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690548222, + "narHash": "sha256-EcVjLOpbAuL/y55fLlEl3BNM4FP5Pwtp+6DbTiL6FDM=", + "owner": "nix-community", + "repo": "disko", + "rev": "43f17a8b31c49f6696b8b258d317161afdc7e36b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "disko_2": { "inputs": { "nixpkgs": [ "nixpkgs" @@ -47,6 +70,22 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -67,6 +106,46 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "clan-core", + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "nixlib": { "locked": { "lastModified": 1688259758, @@ -105,6 +184,38 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1689261696, + "narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "df1eee2aa65052a18121ed4971081576b25d6b5c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1689846894, "narHash": "sha256-6Ynd2UeWMiCvYXVEW3HOAw/u5HetpegYO2P3T7ccHJ8=", @@ -120,12 +231,34 @@ "type": "github" } }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1690464206, + "narHash": "sha256-38V4kmOh6ikpfGiAS+Kt2H/TA2DubSqE66veP/jmB4Q=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "9289996dcac62fd45836db7c07b87d2521eb526d", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "clan-core": "clan-core", - "disko": "disko", + "disko": "disko_2", "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "sops-nix": "sops-nix", "srvos": "srvos", "treefmt-nix": "treefmt-nix" @@ -172,6 +305,21 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/pkgs/clan-merge/clan_merge/__init__.py b/pkgs/clan-merge/clan_merge/__init__.py index 62c6d5f..3d9ae1e 100644 --- a/pkgs/clan-merge/clan_merge/__init__.py +++ b/pkgs/clan-merge/clan_merge/__init__.py @@ -14,9 +14,10 @@ def load_token() -> str: def is_ci_green(pr: dict) -> bool: print("Checking CI status for PR " + str(pr["id"])) + repo = pr["base"]["repo"]["name"] url = ( "https://git.clan.lol/api/v1/repos/clan/" - + pr["base"]["repo"]["name"] + + repo + "/commits/" + pr["head"]["sha"] + "/status" @@ -24,6 +25,11 @@ def is_ci_green(pr: dict) -> bool: response = urllib.request.urlopen(url) data = json.loads(response.read()) # check for all commit statuses to have status "success" + if not data["statuses"]: + print( + f"No CI status for PR {pr['number']} in repo {repo} from user {pr['user']['login']}" + ) + return False for status in data["statuses"]: if status["status"] != "success": return False