Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wrong endpoint for listing comments #644

@giltho

Description

@giltho

Hello,

I'm using this:

const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number, per_page: 100 });

And it crashes with:

Run actions/github-script@v7
  
RequestError [HttpError]: Not Found
    at /home/runner/work/_actions/actions/github-script/v6/dist/index.js:6842:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async eval (eval at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:15143:16), <anonymous>:10:3)
    at async main (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:15236:20) {
  status: 404,
  response: {
    url: 'https://api.github.com/repos/{ORG}/{REPO}/comments/',
    status: 404,
    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',
...

I've elided ORG and REPO because they're not important. The important part is the trailing slash at the end of the url, which yields a 404. Without the trailing / i.e. 'https://api.github.com/repos/{ORG}/{REPO}/comments', the API doesn't answer 404

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions