Compare commits
10 Commits
091c09450e
...
ccf1674512
| Author | SHA1 | Date | |
|---|---|---|---|
| ccf1674512 | |||
| e15a730b37 | |||
| 3654f170bc | |||
| 055f917142 | |||
| dddfe60234 | |||
|
1481293b7c
|
|||
| e394510993 | |||
|
edb8752dcb
|
|||
| 35144db491 | |||
| b6d08637cf |
384
Cargo.lock
generated
384
Cargo.lock
generated
@@ -22,24 +22,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.3.2"
|
||||
version = "0.6.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
|
||||
checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is-terminal",
|
||||
"is_terminal_polyfill",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.0"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
|
||||
checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
@@ -61,19 +61,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "1.0.1"
|
||||
version = "3.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
|
||||
checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys 0.48.0",
|
||||
"once_cell_polyfill",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.71"
|
||||
version = "1.0.101"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
|
||||
checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea"
|
||||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
@@ -275,33 +276,31 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.3.4"
|
||||
version = "4.5.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed"
|
||||
checksum = "63be97961acde393029492ce0be7a1af7e323e6bae9511ebfac33751be5e6806"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.3.4"
|
||||
version = "4.5.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636"
|
||||
checksum = "7f13174bda5dfd69d7e947827e5af4b0f2f94a4a3ee92912fba07a66150f21e2"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"bitflags 1.3.2",
|
||||
"clap_lex",
|
||||
"strsim",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.3.2"
|
||||
version = "4.5.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"
|
||||
checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
@@ -311,9 +310,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.5.0"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
|
||||
checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
@@ -527,16 +526,6 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ff"
|
||||
version = "0.13.1"
|
||||
@@ -560,10 +549,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
name = "foldhash"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "forge-enforce"
|
||||
@@ -574,6 +563,7 @@ dependencies = [
|
||||
"axum",
|
||||
"clap",
|
||||
"dotenv",
|
||||
"http",
|
||||
"nodrift",
|
||||
"notmad",
|
||||
"octocrab",
|
||||
@@ -724,6 +714,19 @@ dependencies = [
|
||||
"wasip2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasip2",
|
||||
"wasip3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "group"
|
||||
version = "0.13.0"
|
||||
@@ -735,6 +738,15 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
||||
dependencies = [
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.16.1"
|
||||
@@ -743,15 +755,9 @@ checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hkdf"
|
||||
@@ -773,12 +779,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.0.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea"
|
||||
checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa",
|
||||
]
|
||||
|
||||
@@ -914,6 +919,12 @@ dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "id-arena"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.4.0"
|
||||
@@ -931,18 +942,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "io-lifetimes"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"windows-sys 0.48.0",
|
||||
"hashbrown 0.16.1",
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -956,16 +958,10 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.7"
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"io-lifetimes",
|
||||
"rustix",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
@@ -1015,6 +1011,12 @@ dependencies = [
|
||||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "leb128fmt"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.180"
|
||||
@@ -1027,12 +1029,6 @@ version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.10"
|
||||
@@ -1096,12 +1092,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notmad"
|
||||
version = "0.8.1"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6698b96b4bf8b4bb35982cc8233af557954cf3b3c2749cec819fab39acc29e6"
|
||||
checksum = "88f52fa65fdf2dc8bf9e0ba7e95f0966a3d7449f660922cc21d96fe382f5c82e"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"futures",
|
||||
"futures-util",
|
||||
"rand 0.9.2",
|
||||
@@ -1113,12 +1108,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.46.0"
|
||||
version = "0.50.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"overload",
|
||||
"winapi",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1231,18 +1225,18 @@ version = "1.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell_polyfill"
|
||||
version = "1.70.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-probe"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
|
||||
|
||||
[[package]]
|
||||
name = "overload"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
|
||||
|
||||
[[package]]
|
||||
name = "p256"
|
||||
version = "0.13.2"
|
||||
@@ -1380,6 +1374,16 @@ version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "primeorder"
|
||||
version = "0.13.6"
|
||||
@@ -1583,20 +1587,6 @@ dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.37.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"errno",
|
||||
"io-lifetimes",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.36"
|
||||
@@ -1957,9 +1947,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
@@ -2113,9 +2103,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.9.11+spec-1.1.0"
|
||||
version = "1.0.1+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46"
|
||||
checksum = "bbe30f93627849fa362d4a602212d41bb237dc2bd0f8ba0b2ce785012e124220"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde_core",
|
||||
@@ -2128,18 +2118,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.7.5+spec-1.1.0"
|
||||
version = "1.0.0+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
|
||||
checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_parser"
|
||||
version = "1.0.6+spec-1.1.0"
|
||||
version = "1.0.8+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44"
|
||||
checksum = "0742ff5ff03ea7e67c8ae6c93cac239e0d9784833362da3f9a9c1da8dfefcbdc"
|
||||
dependencies = [
|
||||
"winnow 0.7.14",
|
||||
]
|
||||
@@ -2200,11 +2190,10 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.37"
|
||||
version = "0.1.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||
checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
@@ -2213,9 +2202,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.24"
|
||||
version = "0.1.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74"
|
||||
checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2224,9 +2213,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.31"
|
||||
version = "0.1.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a"
|
||||
checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"valuable",
|
||||
@@ -2245,9 +2234,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.18"
|
||||
version = "0.3.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
|
||||
checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e"
|
||||
dependencies = [
|
||||
"nu-ansi-term",
|
||||
"sharded-slab",
|
||||
@@ -2290,6 +2279,12 @@ dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.9.0"
|
||||
@@ -2310,17 +2305,19 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.7.0"
|
||||
version = "1.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a"
|
||||
checksum = "b672338555252d43fd2240c714dc444b8c6fb0a5c5335e65a07bba7742735ddb"
|
||||
dependencies = [
|
||||
"getrandom 0.2.17",
|
||||
"getrandom 0.4.1",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2359,6 +2356,15 @@ dependencies = [
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasip3"
|
||||
version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
|
||||
dependencies = [
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.108"
|
||||
@@ -2404,6 +2410,40 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-encoder"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
|
||||
dependencies = [
|
||||
"leb128fmt",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-metadata"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"indexmap",
|
||||
"wasm-encoder",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"hashbrown 0.15.5",
|
||||
"indexmap",
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-time"
|
||||
version = "1.1.0"
|
||||
@@ -2415,28 +2455,6 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.62.2"
|
||||
@@ -2731,6 +2749,88 @@ name = "wit-bindgen"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
|
||||
dependencies = [
|
||||
"wit-bindgen-rust-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-core"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
"wit-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rust"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
"indexmap",
|
||||
"prettyplease",
|
||||
"syn",
|
||||
"wasm-metadata",
|
||||
"wit-bindgen-core",
|
||||
"wit-component",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rust-macro"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wit-bindgen-core",
|
||||
"wit-bindgen-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-component"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags 2.10.0",
|
||||
"indexmap",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"wasm-encoder",
|
||||
"wasm-metadata",
|
||||
"wasmparser",
|
||||
"wit-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-parser"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"id-arena",
|
||||
"indexmap",
|
||||
"log",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"unicode-xid",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
|
||||
@@ -15,4 +15,4 @@ axum = { version = "0.8" }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
tower-http = { version = "0.6", features = ["cors", "trace"] }
|
||||
notmad = "0.8"
|
||||
notmad = "0.11"
|
||||
|
||||
@@ -18,8 +18,9 @@ notmad.workspace = true
|
||||
tokio-util = "0.7.18"
|
||||
async-trait = "0.1.89"
|
||||
regex = "1.12.3"
|
||||
toml = "0.9.11"
|
||||
toml = "1.0.0"
|
||||
nodrift = "0.3.5"
|
||||
octocrab = "0.49.5"
|
||||
schemars = "1.2.1"
|
||||
serde_json = "1.0.149"
|
||||
http = "1"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use regex::Regex;
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -15,7 +17,19 @@ pub struct ForgeConfig {
|
||||
pub schedule: ForgeSchedule,
|
||||
|
||||
#[serde(default)]
|
||||
pub policies: Policies,
|
||||
pub policies: BTreeMap<String, PolicyOption>,
|
||||
|
||||
#[serde(default)]
|
||||
pub mode: Mode,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, JsonSchema, Default)]
|
||||
pub enum Mode {
|
||||
#[serde(rename = "warn")]
|
||||
Warn,
|
||||
#[serde(rename = "update")]
|
||||
#[default]
|
||||
Update,
|
||||
}
|
||||
|
||||
/// # Filter
|
||||
@@ -54,13 +68,6 @@ fn deny_default() -> Vec<ForgeRegex> {
|
||||
vec![]
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Policies {
|
||||
#[serde(default)]
|
||||
pub squash_merge_only: PolicyOption,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct PolicyOption {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::{path::Path, time::Duration};
|
||||
use std::{collections::BTreeMap, path::Path, time::Duration};
|
||||
|
||||
use anyhow::Context;
|
||||
use async_trait::async_trait;
|
||||
@@ -8,7 +8,7 @@ use tokio_util::sync::CancellationToken;
|
||||
|
||||
use crate::{
|
||||
State,
|
||||
forge_config::{ForgeConfig, ForgeConfigType, ForgeSchedule, GitHubCredentials},
|
||||
forge_config::{ForgeConfig, ForgeConfigType, ForgeSchedule, GitHubCredentials, Mode},
|
||||
forges,
|
||||
};
|
||||
|
||||
@@ -18,6 +18,105 @@ pub struct ForgeService {
|
||||
config: ForgeConfig,
|
||||
}
|
||||
|
||||
impl ForgeService {
|
||||
async fn sync(&self) -> anyhow::Result<()> {
|
||||
match &self.config.forge_type {
|
||||
ForgeConfigType::GitHub {
|
||||
credentials,
|
||||
organisation,
|
||||
} => {
|
||||
let creds = match credentials.clone() {
|
||||
GitHubCredentials::Token(token) => {
|
||||
forges::github::GitHubCredentials::Token(token)
|
||||
}
|
||||
GitHubCredentials::TokenEnv(key) => {
|
||||
let token =
|
||||
std::env::var(key).context("failed to lookup github token env")?;
|
||||
|
||||
forges::github::GitHubCredentials::Token(token)
|
||||
}
|
||||
};
|
||||
|
||||
let client = forges::github::GitHub::new(creds);
|
||||
let policies = forges::github::policies::Policies::new();
|
||||
|
||||
// 1. get repositories matching allow / deny list
|
||||
|
||||
let repos = client
|
||||
.get_repositories(
|
||||
organisation,
|
||||
self.config.filter.allow.iter().map(|a| a.into()).collect(),
|
||||
self.config.filter.deny.iter().map(|a| a.into()).collect(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
for repo in repos {
|
||||
let repo = client.get_repository(&repo).await?;
|
||||
|
||||
let repo_display = serde_json::to_string(&repo)?;
|
||||
tracing::trace!(repo = repo_display, "checking for updates");
|
||||
tracing::debug!(repo = ?repo.full_name, "checking policies");
|
||||
|
||||
let mut all_updates = BTreeMap::new();
|
||||
let mut all_warnings = Vec::new();
|
||||
|
||||
// 2. Evaluate each enabled policy
|
||||
for policy_name in self
|
||||
.config
|
||||
.policies
|
||||
.iter()
|
||||
.filter(|(_, option)| option.enabled)
|
||||
.map(|(p, _)| p)
|
||||
{
|
||||
let policy = policies
|
||||
.get_policy(policy_name)
|
||||
.context(anyhow::anyhow!("failed to find policy: {policy_name}"))?;
|
||||
|
||||
let result = policy.evaluate(&client, &repo).await?;
|
||||
|
||||
all_updates.extend(result.updates);
|
||||
all_warnings.extend(result.warnings);
|
||||
}
|
||||
|
||||
// Always log warnings regardless of mode
|
||||
for warning in &all_warnings {
|
||||
tracing::warn!(repo = ?repo.full_name, "{warning}");
|
||||
}
|
||||
|
||||
if all_updates.is_empty() {
|
||||
if all_warnings.is_empty() {
|
||||
tracing::debug!(repo = ?repo.full_name, "no policy required updating, skipping");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
tracing::info!(repo = ?repo.full_name, "updating repository");
|
||||
|
||||
let updates_display = serde_json::to_string(&all_updates)?;
|
||||
|
||||
match self.config.mode {
|
||||
Mode::Warn => {
|
||||
tracing::error!(update = updates_display, "repository requires update");
|
||||
}
|
||||
Mode::Update => {
|
||||
tracing::info!(update = updates_display, "repository updating");
|
||||
|
||||
// 3. Update repositories
|
||||
client.update_repository(&repo, all_updates).await.context(
|
||||
anyhow::anyhow!(
|
||||
"update repository: {}",
|
||||
repo.full_name.unwrap_or_default()
|
||||
),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Component for ForgeService {
|
||||
fn name(&self) -> Option<String> {
|
||||
@@ -57,39 +156,9 @@ impl nodrift::Drifter for ForgeService {
|
||||
async fn execute(&self, _token: CancellationToken) -> anyhow::Result<()> {
|
||||
tracing::info!("running schedule");
|
||||
|
||||
match &self.config.forge_type {
|
||||
ForgeConfigType::GitHub {
|
||||
credentials,
|
||||
organisation,
|
||||
} => {
|
||||
let creds = match credentials.clone() {
|
||||
GitHubCredentials::Token(token) => {
|
||||
forges::github::GitHubCredentials::Token(token)
|
||||
}
|
||||
GitHubCredentials::TokenEnv(key) => {
|
||||
let token =
|
||||
std::env::var(key).context("failed to lookup github token env")?;
|
||||
|
||||
forges::github::GitHubCredentials::Token(token)
|
||||
}
|
||||
};
|
||||
|
||||
let client = forges::github::GitHub::new(creds);
|
||||
|
||||
// 1. get repositories matching allow / deny list
|
||||
|
||||
client
|
||||
.get_repositories(
|
||||
organisation,
|
||||
self.config.filter.allow.iter().map(|a| a.into()).collect(),
|
||||
self.config.filter.deny.iter().map(|a| a.into()).collect(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
// 2. Get updates for each
|
||||
// 3. Update repositories
|
||||
}
|
||||
}
|
||||
self.sync()
|
||||
.await
|
||||
.inspect_err(|e| tracing::warn!("failed to update repository: {e:#}"))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use anyhow::Context;
|
||||
use octocrab::{Octocrab, models::Repository};
|
||||
use regex::Regex;
|
||||
|
||||
pub mod policies;
|
||||
|
||||
pub struct GitHub {
|
||||
credentials: GitHubCredentials,
|
||||
client: Octocrab,
|
||||
@@ -29,6 +33,14 @@ impl GitHub {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_repository(&self, repo: &Repository) -> anyhow::Result<Repository> {
|
||||
self.client
|
||||
.repos_by_id(repo.id)
|
||||
.get()
|
||||
.await
|
||||
.context("repo by id")
|
||||
}
|
||||
|
||||
pub async fn get_repositories(
|
||||
&self,
|
||||
organisation: &str,
|
||||
@@ -97,4 +109,47 @@ impl GitHub {
|
||||
|
||||
Ok(allowed_repos)
|
||||
}
|
||||
|
||||
pub async fn file_exists(&self, repo: &Repository, path: &str) -> anyhow::Result<bool> {
|
||||
let full_name = repo.full_name.as_ref().context("full name is required")?;
|
||||
let parts: Vec<&str> = full_name.splitn(2, '/').collect();
|
||||
anyhow::ensure!(parts.len() == 2, "invalid full_name format: {full_name}");
|
||||
let (owner, name) = (parts[0], parts[1]);
|
||||
|
||||
match self
|
||||
.client
|
||||
.repos(owner, name)
|
||||
.get_content()
|
||||
.path(path)
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
Ok(_) => Ok(true),
|
||||
Err(octocrab::Error::GitHub { source, .. })
|
||||
if source.status_code == http::StatusCode::NOT_FOUND =>
|
||||
{
|
||||
Ok(false)
|
||||
}
|
||||
Err(e) => Err(e.into()),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update_repository(
|
||||
&self,
|
||||
repo: &Repository,
|
||||
options: BTreeMap<String, serde_json::Value>,
|
||||
) -> anyhow::Result<()> {
|
||||
let _res: serde_json::Value = self
|
||||
.client
|
||||
.patch(
|
||||
format!(
|
||||
"/repos/{}",
|
||||
repo.full_name.as_ref().context("full name is required")?
|
||||
),
|
||||
Some(&options),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
69
crates/forge-enforce/src/forges/github/policies.rs
Normal file
69
crates/forge-enforce/src/forges/github/policies.rs
Normal file
@@ -0,0 +1,69 @@
|
||||
use std::{collections::BTreeMap, sync::Arc};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use octocrab::models::Repository;
|
||||
|
||||
use crate::forges::github::GitHub;
|
||||
|
||||
pub mod auto_merge;
|
||||
pub mod has_codeowners;
|
||||
pub mod squash_merge;
|
||||
|
||||
pub struct PolicyResult {
|
||||
pub updates: BTreeMap<String, serde_json::Value>,
|
||||
pub warnings: Vec<String>,
|
||||
}
|
||||
|
||||
impl PolicyResult {
|
||||
pub fn ok() -> Self {
|
||||
Self {
|
||||
updates: BTreeMap::new(),
|
||||
warnings: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn warn(message: impl Into<String>) -> Self {
|
||||
Self {
|
||||
updates: BTreeMap::new(),
|
||||
warnings: vec![message.into()],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.updates.is_empty() && self.warnings.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait Policy: Send + Sync {
|
||||
async fn evaluate(&self, client: &GitHub, repo: &Repository) -> anyhow::Result<PolicyResult>;
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Policies {
|
||||
policies: Arc<BTreeMap<String, Arc<dyn Policy + 'static>>>,
|
||||
}
|
||||
|
||||
impl Policies {
|
||||
pub fn new() -> Self {
|
||||
let mut policies: BTreeMap<String, Arc<dyn Policy + 'static>> = BTreeMap::new();
|
||||
|
||||
policies.insert(
|
||||
"squash_merge_only".into(),
|
||||
Arc::new(squash_merge::SquashMergeOnly),
|
||||
);
|
||||
policies.insert("allow_auto_merge".into(), Arc::new(auto_merge::AutoMerge));
|
||||
policies.insert(
|
||||
"has_codeowners".into(),
|
||||
Arc::new(has_codeowners::HasCodeowners),
|
||||
);
|
||||
|
||||
Self {
|
||||
policies: Arc::new(policies),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_policy(&self, policy_name: &str) -> Option<Arc<dyn Policy + 'static>> {
|
||||
self.policies.get(policy_name).cloned()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use octocrab::models::Repository;
|
||||
|
||||
use crate::forges::github::GitHub;
|
||||
use crate::forges::github::policies::{Policy, PolicyResult};
|
||||
|
||||
pub struct AutoMerge;
|
||||
|
||||
#[async_trait]
|
||||
impl Policy for AutoMerge {
|
||||
async fn evaluate(&self, _client: &GitHub, repo: &Repository) -> anyhow::Result<PolicyResult> {
|
||||
if repo.allow_auto_merge.unwrap_or_default() {
|
||||
tracing::trace!("already has allow auto merge: {:?}", repo.allow_auto_merge);
|
||||
return Ok(PolicyResult::ok());
|
||||
}
|
||||
|
||||
Ok(PolicyResult {
|
||||
updates: BTreeMap::from([(
|
||||
"allow_auto_merge".to_string(),
|
||||
serde_json::Value::Bool(true),
|
||||
)]),
|
||||
warnings: Vec::new(),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
use async_trait::async_trait;
|
||||
use octocrab::models::Repository;
|
||||
|
||||
use crate::forges::github::GitHub;
|
||||
use crate::forges::github::policies::{Policy, PolicyResult};
|
||||
|
||||
const CODEOWNERS_PATHS: &[&str] = &["CODEOWNERS", ".github/CODEOWNERS", "docs/CODEOWNERS"];
|
||||
|
||||
pub struct HasCodeowners;
|
||||
|
||||
#[async_trait]
|
||||
impl Policy for HasCodeowners {
|
||||
async fn evaluate(&self, client: &GitHub, repo: &Repository) -> anyhow::Result<PolicyResult> {
|
||||
for path in CODEOWNERS_PATHS {
|
||||
if client.file_exists(repo, path).await? {
|
||||
tracing::trace!(
|
||||
repo = ?repo.full_name,
|
||||
path,
|
||||
"CODEOWNERS file found"
|
||||
);
|
||||
return Ok(PolicyResult::ok());
|
||||
}
|
||||
}
|
||||
|
||||
let repo_name = repo.full_name.as_deref().unwrap_or(&repo.name);
|
||||
Ok(PolicyResult::warn(format!(
|
||||
"{repo_name}: no CODEOWNERS file found (checked: {})",
|
||||
CODEOWNERS_PATHS.join(", ")
|
||||
)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use octocrab::models::Repository;
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::forges::github::GitHub;
|
||||
use crate::forges::github::policies::{Policy, PolicyResult};
|
||||
|
||||
pub struct SquashMergeOnly;
|
||||
|
||||
#[async_trait]
|
||||
impl Policy for SquashMergeOnly {
|
||||
async fn evaluate(&self, _client: &GitHub, repo: &Repository) -> anyhow::Result<PolicyResult> {
|
||||
let mut updates = BTreeMap::new();
|
||||
|
||||
if !repo.allow_squash_merge.unwrap_or_default() {
|
||||
tracing::trace!(
|
||||
"repo requires squash merge update: {:?}",
|
||||
repo.allow_squash_merge
|
||||
);
|
||||
|
||||
updates.insert("allow_squash_merge".to_string(), Value::Bool(true));
|
||||
updates.insert(
|
||||
"squash_merge_commit_title".into(),
|
||||
Value::String("PR_TITLE".into()),
|
||||
);
|
||||
updates.insert(
|
||||
"squash_merge_commit_message".into(),
|
||||
Value::String("PR_BODY".into()),
|
||||
);
|
||||
}
|
||||
|
||||
if !repo.allow_merge_commit.unwrap_or(true) {
|
||||
tracing::trace!(
|
||||
"repo requires disabling merge commit: {:?}",
|
||||
repo.allow_merge_commit
|
||||
);
|
||||
|
||||
updates.insert("allow_merge_commit".into(), Value::Bool(false));
|
||||
}
|
||||
|
||||
Ok(PolicyResult {
|
||||
updates,
|
||||
warnings: Vec::new(),
|
||||
})
|
||||
}
|
||||
}
|
||||
1
crates/forge-enforce/src/policies.rs
Normal file
1
crates/forge-enforce/src/policies.rs
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
16
templates/fe/configs/codeowners-check.toml
Normal file
16
templates/fe/configs/codeowners-check.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
#:schema ../schema.json
|
||||
|
||||
mode = "warn"
|
||||
|
||||
[github]
|
||||
organisation = "understory-io"
|
||||
credentials.token_env = "GITHUB_ACCESS_TOKEN"
|
||||
|
||||
[filter]
|
||||
allow = ["^canopy-.*$"]
|
||||
|
||||
[schedule]
|
||||
once = true
|
||||
|
||||
[policies]
|
||||
has_codeowners.enabled = true
|
||||
@@ -1,17 +1,18 @@
|
||||
#:schema ../schema.json
|
||||
|
||||
mode = "update"
|
||||
|
||||
[github]
|
||||
organisation = "understory-io"
|
||||
credentials.token_env = "GITHUB_ACCESS_TOKEN"
|
||||
|
||||
|
||||
[filter]
|
||||
allow = ["^canopy-.*$"]
|
||||
deny = ["^infrastructure-.*$", "^canopy-data-gateway$"]
|
||||
allow = ["^canopy-data-gateway$"]
|
||||
# deny = ["^infrastructure-.*$", "^canopy-data-gateway$"]
|
||||
|
||||
[schedule]
|
||||
once = true
|
||||
|
||||
|
||||
[policies]
|
||||
squash_merge_only.enabled = true
|
||||
allow_auto_merge.enabled = true
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
"$ref": "#/$defs/Filter"
|
||||
},
|
||||
"policies": {
|
||||
"$ref": "#/$defs/Policies"
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/$defs/PolicyOption"
|
||||
}
|
||||
},
|
||||
"schedule": {
|
||||
"$ref": "#/$defs/ForgeSchedule"
|
||||
@@ -137,15 +140,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"Policies": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"squash_merge_only": {
|
||||
"$ref": "#/$defs/PolicyOption"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"PolicyOption": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in New Issue
Block a user