Open gsaslis opened 1 year ago
The Patch
cob implements the FromHistory
trait. The implementation of the apply
function handles the various operations that can be applies to a patch. In there we find Action::Review
, Action::ReviewComment
and Action::RevisionComment
that seem to be useful to us. Action
enum is declared in radicle/src/cob/patch.rs
.
The struct PatchMut
offers the following methods:
thread
: Commits an Action::RevisionComment
operation. This starts a patch revision discussion.comment
: Commits an Action::RevisionComment
operation. This is a comment added to an existing comment.review
: Commits an Action::Review
operation.I may be missing something but the PatchMut
methods are not getting called anywhere in the codebase yet.
Action::RevisionComment
It needs a revision id and a string body at minimum. Optionally it can refer to a code location or reply to another comment, however we do not care about these two. It will create a new instance of the Comment
struct.
Action::Review
It needs a revision id at minimum. Optionally it may have a summary, a verdict (accept or reject) and labels.
A first comment could be:
The CI job has PASSED! 🎉
Please visit ${job_url} for more details.
or, if it failed:
The CI job has FAILED! 🙁
Please visit ${job_url} for more details.
Once the job is finished, the CI broker should update the Patch that it triggered the job for.
To begin with, we will add a simple comment pointing to the job results. (Later this should change to updating some collaborative object, etc. instead)