feat(ops/gerrit-webhook-to-irccat): notify when CLs are undrafted
- Extend the notification template to handle `wip-state-changed` events where a change is undrafted (i.e., `.Change.Wip` is false or not present). - Add test cases for undrafting (should notify) and re-drafting (should not notify). - Ensure correct handling of `.Changer.Username` for undraft notifications. - Update Go module dependencies for test coverage. (`go mod tidy`) This allows the IRC bot to notify when a change is moved out of WIP/draft state, improving visibility for ready-for-review CLs. Fixes #167. Change-Id: I6a6a69642369726c3bd9f523ae025c34dba8c4aa Reviewed-on: https://cl.snix.dev/c/snix/+/30641 Reviewed-by: Oleksandr Knyshuk <olk@disr.it> Tested-by: besadii Reviewed-by: Florian Klink <flokli@flokli.de>
This commit is contained in:
parent
2a1cd31d52
commit
8d0ae4f7ae
4 changed files with 10 additions and 7 deletions
|
|
@ -21,6 +21,10 @@ var jsonMsgs = []struct {
|
|||
"#snix CL/30605 applied by jade - fix(ops/gerrit): send mail with the triggering user's name on it - https://cl.snix.dev/c/snix/+/30605"},
|
||||
{"{\"submitter\":{\"name\":\"clbot\",\"username\":\"clbot\"},\"newRev\":\"afec95e269e2d59e10fb205eb793d7261b638dc2\",\"patchSet\":{\"number\":2,\"revision\":\"099f14194bcee28133af01a6e324b2fe4ecccd7c\",\"parents\":[\"9942014989bcc56b1a302ef6eb2b9f2e2aecccb8\"],\"ref\":\"refs/changes/99/30599/2\",\"uploader\":{\"name\":\"clbot\",\"username\":\"clbot\"},\"createdOn\":1751906446,\"author\":{\"name\":\"Florian Klink\",\"email\":\"flokli@flokli.de\",\"username\":\"flokli\"},\"kind\":\"NO_CODE_CHANGE\",\"sizeInsertions\":20,\"sizeDeletions\":0},\"change\":{\"project\":\"snix\",\"branch\":\"canon\",\"id\":\"I449101cfda7c8a728d3e2f3be71dee00be780ec3\",\"number\":30599,\"subject\":\"doc(README): point to website once more\",\"owner\":{\"name\":\"Florian Klink\",\"email\":\"flokli@flokli.de\",\"username\":\"flokli\"},\"url\":\"https://cl.snix.dev/c/snix/+/30599\",\"commitMessage\":\"doc(README): point to website once more\\n\\nThere\\u0027s no point in replicating redundant information in many different\\nplaces. Add some more pointers and encouragement to read the docs where\\nthey live.\\n\\nChange-Id: I449101cfda7c8a728d3e2f3be71dee00be780ec3\\nReviewed-on: https://cl.snix.dev/c/snix/+/30599\\nTested-by: besadii\\nReviewed-by: Vova Kryachko \\u003cv.kryachko@gmail.com\\u003e\\nAutosubmit: Florian Klink \\u003cflokli@flokli.de\\u003e\\n\",\"createdOn\":1751899755,\"status\":\"MERGED\"},\"project\":{\"name\":\"snix\"},\"refName\":\"refs/heads/canon\",\"changeKey\":{\"key\":\"I449101cfda7c8a728d3e2f3be71dee00be780ec3\"},\"type\":\"change-merged\",\"eventCreatedOn\":1751906446}",
|
||||
"#snix CL/30599 by flokli autosubmitted - doc(README): point to website once more - https://cl.snix.dev/c/snix/+/30599"},
|
||||
{"{\"changer\":{\"name\":\"Florian Klink\",\"email\":\"flokli@flokli.de\",\"username\":\"flokli\"},\"patchSet\":{\"number\":5,\"revision\":\"944b6f97be4cad910f7a831a9a24e5d3da06d77b\",\"parents\":[\"424d56733e9254dc4609ab2abed2b1ea24e7f514\"],\"ref\":\"refs/changes/28/30628/5\",\"uploader\":{\"name\":\"Florian Klink\",\"email\":\"flokli@flokli.de\",\"username\":\"flokli\"},\"createdOn\":1753962503,\"author\":{\"name\":\"Florian Klink\",\"email\":\"flokli@flokli.de\",\"username\":\"flokli\"},\"kind\":\"TRIVIAL_REBASE\",\"sizeInsertions\":16,\"sizeDeletions\":3},\"change\":{\"project\":\"snix\",\"branch\":\"canon\",\"id\":\"I1ae84e743281125ecbdc98cdb4f2adf5a96905a7\",\"number\":30628,\"subject\":\"chore(3p/nixpkgs): bump channels (2025-07-31)\",\"owner\":{\"name\":\"Florian Klink\",\"email\":\"flokli@flokli.de\",\"username\":\"flokli\"},\"url\":\"https://cl.snix.dev/c/snix/+/30628\",\"commitMessage\":\"chore(3p/nixpkgs): bump channels (2025-07-31)\\n\\nChange-Id: I1ae84e743281125ecbdc98cdb4f2adf5a96905a7\\n\",\"createdOn\":1753953838,\"status\":\"NEW\"},\"project\":\"snix\",\"refName\":\"refs/heads/canon\",\"changeKey\":{\"id\":\"I1ae84e743281125ecbdc98cdb4f2adf5a96905a7\"},\"type\":\"wip-state-changed\",\"eventCreatedOn\":1753963017}",
|
||||
"#snix CL/30628 undrafted by flokli - chore(3p/nixpkgs): bump channels (2025-07-31) - https://cl.snix.dev/c/snix/+/30628"},
|
||||
{"{\"changer\":{\"name\":\"Florian Klink\",\"email\":\"flokli@flokli.de\",\"username\":\"flokli\"},\"patchSet\":{\"number\":5,\"revision\":\"944b6f97be4cad910f7a831a9a24e5d3da06d77b\",\"parents\":[\"424d56733e9254dc4609ab2abed2b1ea24e7f514\"],\"ref\":\"refs/changes/28/30628/5\",\"uploader\":{\"name\":\"Florian Klink\",\"email\":\"flokli@flokli.de\",\"username\":\"flokli\"},\"createdOn\":1753962503,\"author\":{\"name\":\"Florian Klink\",\"email\":\"flokli@flokli.de\",\"username\":\"flokli\"},\"kind\":\"TRIVIAL_REBASE\",\"sizeInsertions\":16,\"sizeDeletions\":3},\"change\":{\"project\":\"snix\",\"branch\":\"canon\",\"id\":\"I1ae84e743281125ecbdc98cdb4f2adf5a96905a7\",\"number\":30628,\"subject\":\"chore(3p/nixpkgs): bump channels (2025-07-31)\",\"owner\":{\"name\":\"Florian Klink\",\"email\":\"flokli@flokli.de\",\"username\":\"flokli\"},\"url\":\"https://cl.snix.dev/c/snix/+/30628\",\"commitMessage\":\"chore(3p/nixpkgs): bump channels (2025-07-31)\\n\\nChange-Id: I1ae84e743281125ecbdc98cdb4f2adf5a96905a7\\n\",\"createdOn\":1753953838,\"status\":\"NEW\",\"wip\":true},\"project\":\"snix\",\"refName\":\"refs/heads/canon\",\"changeKey\":{\"id\":\"I1ae84e743281125ecbdc98cdb4f2adf5a96905a7\"},\"type\":\"wip-state-changed\",\"eventCreatedOn\":1753963011}",
|
||||
""},
|
||||
}
|
||||
|
||||
func TestParseChangeProposed(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue