Repository: iterative/cml (js)

Issue:
`send-comment --pr --update` not working without specifying `--commit-sha=HEAD`
This workflow threw the following error:

```
- name: Train model
        env:
          REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
        run: |
          set -x
          cml ci
          pip install -r requirements.txt
          python get_data.py
          python train.py

          # Create pull request
          cml pr model/random_forest.joblib

          # Create CML report
          cat model/metrics.txt > report.md
          cml publish model/confusion_matrix.png --md >> report.md
          cml send-comment --pr --update report.md
```
```
{"level":"error","message":"PR for commit sha \"54e32ca98b5faa1f7982a682e0f6de07347a7531\" not found","stack":"Error: PR for commit sha \"54e32ca98b5faa1f7982a682e0f6de07347a7531\" not found\n    at CML.commentCreate (/snapshot/cml/src/cml.js:185:15)\n    at async Object.exports.handler (/snapshot/cml/bin/cml/send-comment.js:13:15)"}
Error: Process completed with exit code 1.
```

After some back and forth on Slack, we came to the following:

:x: Do not work:
- `cml send-comment --pr --update report.md`
- `cml send-comment --commit-sha --pr --update report.md`

:white_check_mark: Do work:
- `cml send-comment --update report.md`
- `cml send-comment --commit-sha=HEAD --pr --update report.md`

I am currently unsure of the precise intended workings; is `send-comment --pr --update` a valid use case or not? Different views in Slack, so creating a ticket here for further discussion.


Pull request:
Default to `HEAD` on `send-comment --commit-sha`
> [_`--commit-sha=<rev>`: Git revision linked to this comment [default: HEAD]._](https://cml.dev/doc/ref/send-comment#options)

Closes #991. Documentation is a lie! It defaulted to `triggerSha` which doesn't get updated when `cml pr` runs.

https://github.com/iterative/cml/blob/352fba44faf2eb69d81d4cb5f60220f60f5f8e49/src/cml.js#L143

Patch:
diff --git a/bin/cml/send-comment.js b/bin/cml/send-comment.js
index 621ab93..09a291d 100644
--- a/bin/cml/send-comment.js
+++ b/bin/cml/send-comment.js
@@ -24,7 +24,8 @@ exports.builder = (yargs) =>
       commitSha: {
         type: 'string',
         alias: 'head-sha',
-        description: 'Commit SHA linked to this comment. Defaults to HEAD.'
+        default: 'HEAD',
+        description: 'Commit SHA linked to this comment'
       },
       update: {
         type: 'boolean',


Test patch:
diff --git a/bin/cml/send-comment.test.js b/bin/cml/send-comment.test.js
index 7cf1aa7..0b6b093 100644
--- a/bin/cml/send-comment.test.js
+++ b/bin/cml/send-comment.test.js
@@ -14,31 +14,31 @@ describe('Comment integration tests', () => {
     const output = await exec(`node ./bin/cml.js send-comment --help`);
 
     expect(output).toMatchInlineSnapshot(`
-"cml.js send-comment <markdown file>
+      "cml.js send-comment <markdown file>
 
-Comment on a commit
+      Comment on a commit
 
-Options:
-  --help                    Show help                                  [boolean]
-  --version                 Show version number                        [boolean]
-  --log                     Maximum log level
-          [string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"]
-  --pr                      Post to an existing PR/MR associated with the
-                            specified commit                           [boolean]
-  --commit-sha, --head-sha  Commit SHA linked to this comment. Defaults to HEAD.
-                                                                        [string]
-  --update                  Update the last CML comment (if any) instead of
-                            creating a new one                         [boolean]
-  --rm-watermark            Avoid watermark. CML needs a watermark to be able to
-                            distinguish CML reports from other comments in order
-                            to provide extra functionality.            [boolean]
-  --repo                    Specifies the repo to be used. If not specified is
-                            extracted from the CI ENV.                  [string]
-  --token                   Personal access token to be used. If not specified
-                            is extracted from ENV REPO_TOKEN.           [string]
-  --driver                  If not specify it infers it from the ENV.
-                             [string] [choices: \\"github\\", \\"gitlab\\", \\"bitbucket\\"]"
-`);
+      Options:
+        --help                    Show help                                  [boolean]
+        --version                 Show version number                        [boolean]
+        --log                     Maximum log level
+                [string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"]
+        --pr                      Post to an existing PR/MR associated with the
+                                  specified commit                           [boolean]
+        --commit-sha, --head-sha  Commit SHA linked to this comment
+                                                            [string] [default: \\"HEAD\\"]
+        --update                  Update the last CML comment (if any) instead of
+                                  creating a new one                         [boolean]
+        --rm-watermark            Avoid watermark. CML needs a watermark to be able to
+                                  distinguish CML reports from other comments in order
+                                  to provide extra functionality.            [boolean]
+        --repo                    Specifies the repo to be used. If not specified is
+                                  extracted from the CI ENV.                  [string]
+        --token                   Personal access token to be used. If not specified
+                                  is extracted from ENV REPO_TOKEN.           [string]
+        --driver                  If not specify it infers it from the ENV.
+                                   [string] [choices: \\"github\\", \\"gitlab\\", \\"bitbucket\\"]"
+    `);
   });
 
   test('cml send-comment to specific repo', async () => {