gsaslis / radicle-ci-broker

A placeholder project to use for issue tracking
0 stars 0 forks source link

Broker should add comment to patch that it ran a CI job for #6

Open gsaslis opened 1 year ago

gsaslis commented 1 year ago

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)

Archimidis commented 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:

  1. thread: Commits an Action::RevisionComment operation. This starts a patch revision discussion.
  2. comment: Commits an Action::RevisionComment operation. This is a comment added to an existing comment.
  3. 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.

gsaslis commented 1 year ago

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.