iterative/cml

Error: cml comment create report.md

b00nw33 opened this issue · 9 comments

I was able to get example repo working properly, but when I try to replicate it in my work, I encounter the following error with cml comment create report.md in cml.yaml.

{"level":"error","message":"token not found","stack":"Error: token not found\n at new Github (/usr/lib/node_modules/@dvcorg/cml/src/drivers/github.js:91:23)\n at CML.getDriver (/usr/lib/node_modules/@dvcorg/cml/src/cml.js:161:35)\n at CML.commentCreate (/usr/lib/node_modules/@dvcorg/cml/src/cml.js:184:22)\n at Object.exports.handler (/usr/lib/node_modules/@dvcorg/cml/bin/cml/comment/create.js:11:25)\n at /usr/lib/node_modules/@dvcorg/cml/node_modules/yargs/build/index.cjs:1:8993\n at /usr/lib/node_modules/@dvcorg/cml/node_modules/yargs/build/index.cjs:1:4949"}

Hello, @b00nw33! Can you please share a copy of your workflow?

@0x2b3bfa0 Sure, thanks for reaching out!

example_cml - working

wine - error

mycaret - error

On https://github.com/b00nw33/mycaret/actions/runs/6143774135/workflow, you're passing the token to the wrong step.

  name: Auto mycaret
  on: [push]
  jobs:
    train-and-report:
      runs-on: ubuntu-latest
      container: docker://ghcr.io/iterative/cml:0-dvc2-base1
      steps:
        - name: Checkout code
          uses: actions/checkout@v4
        - name: Install dependencies
-         env:
-           REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          run: |
            python -m pip install --upgrade pip
            pip install -r requirements.txt
            pip install pycaret[full]
        - name: Run app.py
+         env:
+           REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          run: |
            python app.py  # generate plot.png
            # Create CML report
            cat metrics.txt >> report.md
            # echo '![](./plot.png "Confusion Matrix")' >> report.md
            cml comment create report.md
        - name: Finalising
          run: |
            echo "Done!"

On https://github.com/b00nw33/wine/actions/runs/6148077199/job/16680984239#step:5:14, it can't find results.txt, probably because it doesn't exist.

Thanks @0x2b3bfa0 , made changes accordingly.

Now I'm getting this error from the following line:

echo "![](./feature_importance.png)" >> report.md

Can you please try renaming your image files so they don't contain underscores? I believe there might be some parsing issue with underscores, also on the GitHub flavor of CML.

#1347

Renamed to features.png, and got this error.

dacbd commented

Renamed to features.png, and got this error.

@b00nw33 sorry for the inconvenience, can you try with the actions/setup-node that you have commented out.

Renamed to features.png, and got this error.

@b00nw33 sorry for the inconvenience, can you try with the actions/setup-node that you have commented out.

@dacbd Thanks, working now. Looks like it needs either uses: actions/setup-node@v3 or container: ghcr.io/iterative/cml:0-dvc2-base1 to work.