22
33## create
44
5- Post a Markdown report as a comment on a commit or pull/merge request.
5+ Post a markdown report as a comment on a commit, pull/merge request, or issue .
66
77``` usage
88cml comment create [options] <markdown report file>
@@ -19,36 +19,58 @@ cml comment update [options] <markdown report file>
1919
2020<admon type =" tip " >
2121
22- If there's an associated pull/merge request, consider using ` update ` with the
23- ` --pr ` flag.
24-
25- </admon >
26-
27- <admon type =" tip " >
28-
29- If [ ` cml pr ` ] ( /doc/ref/pr ) was used earlier in the workflow, use
30- ` --commit-sha=HEAD ` to post comments to the new PR if desired.
22+ When using multiple reports, use
23+ [ ` --watermark-title=<...> ` ] ( #managing-multiple-comments ) to specify which
24+ comment to ` update ` .
3125
3226</admon >
3327
3428## Options
3529
3630Any [ generic option] ( /doc/ref ) in addition to:
3731
38- - ` --commit-sha=<rev> ` , ` --head-sha=<rev> ` :
39- [ Git revision ] ( https://git-scm.com/docs/gitrevisions ) linked to this comment
40- [ default: ` HEAD ` ] .
41- - ` --pr ` : Post to an existing PR/MR associated with the specified commit.
32+ - ` --target=<pr|commit|issue>[/ref] ` : Where to post/associate with the comment
33+ ( ` pr ` , ` commit ` , ` issue ` ), optionally with a reference ( ` issue/12 ` , ` pr/17 ` ,
34+ ` commit/ ` [ rev ] ( https://git-scm.com/docs/gitrevisions ) [ default: ` pr ` falling
35+ back to ` commit/HEAD ` ] .
4236- ` --watch ` : Watch for changes and automatically update the comment (doesn't
4337 exit, consider
4438 [ appending ` & ` to run in the background] ( < https://en.wikipedia.org/wiki/Job_control_(Unix)#Implementation > ) ).
4539- ` --publish=<true|false> ` : Upload any local images found in the Markdown report
4640 [ default: ` true ` ] .
4741- ` --publish-native ` : Use ` --driver ` 's native capabilities to ` --publish ` assets
4842 instead of ` --publish-url ` (not available on ` --driver=github ` ).
49- - ` --publish-url=<url > ` : Self-hosted image server URL [ default:
43+ - ` --publish-url=<... > ` : Self-hosted image server URL [ default:
5044 ` https://asset.cml.dev ` ] , see
5145 [ minroud-s3] ( https://github.com/iterative/minroud-s3 ) .
46+ - ` --watermark-title=<...> ` : Hidden comment marker (useful to
47+ [ specify which comment to update] ( #managing-multiple-comments ) in subsequent
48+ ` cml comment update ` calls); ` "{workflow}" ` and ` "{run}" ` are auto-replaced.
49+
50+ ## Examples
51+
52+ ### Managing multiple comments
53+
54+ Repeatedly running ` cml comment create ` may produce too many comments. Meanwhile
55+ ` cml comment update ` will only produce/update one comment. What if you'd like to
56+ have exactly two comments (corresponding to two different markdown reports,
57+ possibly from different parallel workflows) visible at a time?
58+
59+ To mark and subsequently update a particular comment, use
60+ ` --watermark-title="some text" ` . To mark a comment according to the workflow or
61+ run ID, include the placeholder text ` "{workflow}" ` and ` "{run}" ` . For example:
62+
63+ ``` cli
64+ # Create and constantly update 2 separate comments
65+ $ cml comment update --watch --watermark-title='first {workflow} report' report.md &
66+ $ cml comment update --watch --watermark-title='second {workflow} report' debug.md &
67+ $ python train.py --report-file=report.md --debug-file=debug.md
68+
69+ # Same, but create a new pair of comments if rerunning a workflow
70+ $ cml comment update --watch --watermark-title='first {run} report' report.md &
71+ $ cml comment update --watch --watermark-title='second {run} report' debug.md &
72+ $ python train.py --report-file=report.md --debug-file=debug.md
73+ ```
5274
5375## FAQs and Known Issues
5476
0 commit comments