iterative / cml

♾️ CML - Continuous Machine Learning | CI/CD for ML
http://cml.dev
Apache License 2.0
3.99k stars 333 forks source link

Token not found error #1425

Closed Sandy0002 closed 11 months ago

Sandy0002 commented 11 months ago

I am building a cml workflow in that I wrote below code:

name: Farmers
on: [push]
jobs:
  training:
    runs-on: ubuntu-latest
    steps:
      - uses: iterative/setup-cml@v1
      - uses: actions/checkout@v3
      - name: cml_run
        run: |
          # Your ML workflow goes here
          pip install -r requirements.txt
          dvc repro

          # METRICS TRACKING
          # for pulling git history on runner
          git fetch --prune 
          dvc metrics diff main > report.md

          # Add figure to report
          echo "## Validating results by region"
          # cml-publish by_region.png --md >> report.md
          echo '![](./by_region.png "Regional performances")' >> report.md
          cml comment create report.md

Now for this code I am getting below error as TOKEN NOT FOUND

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

How to fix this?

0x2b3bfa0 commented 11 months ago
name: Farmers
on: [push]
jobs:
  training:
    runs-on: ubuntu-latest
    steps:
      - uses: iterative/setup-cml@v1
      - uses: actions/checkout@v3
      - name: cml_run
        run: |
          # Your ML workflow goes here
          pip install -r requirements.txt
          dvc repro

          # METRICS TRACKING
          # for pulling git history on runner
          git fetch --prune 
          dvc metrics diff main > report.md

          # Add figure to report
          echo "## Validating results by region"
          # cml-publish by_region.png --md >> report.md
          echo '![](./by_region.png "Regional performances")' >> report.md
          cml comment create report.md
+       env:
+         CML_TOKEN: ${{ github.token }}
Sandy0002 commented 11 months ago

It worked thank you.

But again I am getting the URL error which I posted earlier and I am not able to understand how to debug it.

0x2b3bfa0 commented 11 months ago

@Sandy0002, can you please try adding something like ls -l ./by_region.png before cml comment create and see what happens?

Sandy0002 commented 11 months ago

It gave like this:

-rw-r--r-- 1 runner docker 7810 Sep 12 12:50 ./by_region.png

After that I got error message of invalid URL error