Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Resource not accessible by integration #1439

Closed
harshjadhav890 opened this issue Feb 1, 2024 · 1 comment
Closed

Error: Resource not accessible by integration #1439

harshjadhav890 opened this issue Feb 1, 2024 · 1 comment
Labels
epic Collection of sub-issues

Comments

@harshjadhav890
Copy link

Error: Resource not accessible by integration

{"level":"error","message":"Resource not accessible by integration","name":"HttpError","request":{"body":"{"body":"Average Precision:0.7674Test data Precision:0.7696Precision of Background event:0.8530Precision of Signal event:0.7696\n\n![](https://cml.dev/watermark.png#04d9b2365948ae2223244f67969e34b56f17f950 \"CML watermark\")\n"}","headers":{"accept":"application/vnd.github.v3+json","authorization":"token [REDACTED]","content-type":"application/json; charset=utf-8","user-agent":"octokit-rest.js/18.0.0 octokit-core.js/3.6.0 Node.js/16.16.0 (linux; x64)"},"method":"POST","request":{"agent":{}},"url":"https://api.github.com/repos/harshjadhav890/Higgs-Boson/issues/3/comments"},"response":{"data":{"documentation_url":"https://docs.github.com/rest/issues/comments#create-an-issue-comment","message":"Resource not accessible by integration"},"headers":{"access-control-allow-origin":"*","access-control-expose-headers":"ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset","connection":"close","content-encoding":"gzip","content-security-policy":"default-src 'none'","content-type":"application/json; charset=utf-8","date":"Thu, 01 Feb 2024 11:17:15 GMT","referrer-policy":"origin-when-cross-origin, strict-origin-when-cross-origin","server":"GitHub.com","strict-transport-security":"max-age=31536000; includeSubdomains; preload","transfer-encoding":"chunked","vary":"Accept-Encoding, Accept, X-Requested-With","x-accepted-github-permissions":"issues=write; pull_requests=write","x-content-type-options":"nosniff","x-frame-options":"deny","x-github-api-version-selected":"2022-11-28","x-github-media-type":"github.v3; format=json","x-github-request-id":"6492:06D1:37FF164:39DF53D:65BB7DBB","x-ratelimit-limit":"1000","x-ratelimit-remaining":"991","x-ratelimit-reset":"1706789292","x-ratelimit-resource":"core","x-ratelimit-used":"9","x-xss-protection":"0"},"status":403,"url":"https://api.github.com/repos/harshjadhav890/Higgs-Boson/issues/3/comments"},"stack":"HttpError: Resource not accessible by integration\n at /snapshot/cml/node_modules/@octokit/request/dist-node/index.js:86:21\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at async Job.doExecute (/snapshot/cml/node_modules/bottleneck/light.js:405:18)","status":403}
Error: Process completed with exit code 1.

My train.yaml file contents

name: Simple train 
run-name: Simple train
on: [push]
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: iterative/setup-cml@v2
      - name: Train model & Write CML report
        env:
          REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          # Your ML workflow goes here
          pip install -r requirements.txt
          python train.py
          cat results.txt >> report.md
          cml comment create report.md

my train.py file contents

from modelling import preprocess, fit_score
import pandas as pd
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier


df = pd.read_parquet('data/preprocessed_data.parquet')
X, y = preprocess(df)
model, metrics = fit_score(X, y)

for key, value in metrics.items():
    print(f"{key}:{value:.4f}")

with open("results.txt", 'w') as outfile:
    for key, value in metrics.items():
        outfile.write(f"{key}:{value:.4f}")
@harshjadhav890 harshjadhav890 added the epic Collection of sub-issues label Feb 1, 2024
@harshjadhav890 harshjadhav890 changed the title New Feature Error: Resource not accessible by integration Feb 1, 2024
@harshjadhav890
Copy link
Author

harshjadhav890 commented Feb 2, 2024

Linking the solution and closing the issue:
#1377 (comment)

Updated yaml file to train a model and comment the metrics (make sure your train.py creates a results.txt as shown above):

name: Comment Metrics
run-name: Comment Metrics
on: [push]

# adding permissions to tackle error: 'Resource not accessible by integration'
permissions:
    actions: write
    contents: write
    id-token: write
    issues: write
    pull-requests: write
    
jobs:
    Comment-Metrics:
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v4
        - uses: iterative/setup-cml@v2
        - name: Train model & Write CML report
          env:
            REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          run: |
            # Your ML workflow goes here
            pip install -r requirements.txt
            python train.py
            cat results.txt >> report.md
            cml comment create report.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic Collection of sub-issues
Projects
None yet
Development

No branches or pull requests

1 participant