mvasigh / dispatch-action

Github Action for triggering other workflows via message passing
MIT License
57 stars 9 forks source link

RequestError [HttpError]: Not Found #13

Closed christian-bromann closed 3 years ago

christian-bromann commented 3 years ago

I have setup the action as following to trigger another workflow after the pipeline:

      - name: Trigger docs release
        uses: mvasigh/dispatch-action@main
        with:
          token: ${{ secrets.GH_TOKEN }}
          event_type: docs_release

this fails as follows:

Run mvasigh/dispatch-action@main
RequestError [HttpError]: Not Found
    at /home/runner/work/_actions/mvasigh/dispatch-action/main/dist/index.js:9423:31
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async main (/home/runner/work/_actions/mvasigh/dispatch-action/main/dist/index.js:9217:23) {
  name: 'HttpError',
  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-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset',
    connection: 'close',
    'content-encoding': 'gzip',
    'content-security-policy': "default-src 'none'",
    'content-type': 'application/json; charset=utf-8',
    date: 'Tue, 13 Oct 2020 18:37:43 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    status: '404 Not Found',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    'transfer-encoding': 'chunked',
    vary: 'Accept-Encoding, Accept, X-Requested-With',
    'x-accepted-oauth-scopes': '',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'deny',
    'x-github-media-type': 'github.v3; format=json',
    'x-github-request-id': '0402:5D69:C2B11:149BE3:5F85F3F7',
    'x-oauth-scopes': 'admin:org',
    'x-ratelimit-limit': '5000',
    'x-ratelimit-remaining': '4931',
    'x-ratelimit-reset': '1602615319',
    'x-ratelimit-used': '69',
    'x-xss-protection': '1; mode=block'
  },
  request: {
    method: 'POST',
    url: 'api.github.com/repos/webdriverio/webdriverio/dispatches',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit.js/16.43.1 Node.js/12.13.1 (Linux 5.4; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body:...

Am I missing an important token scope here?

mvasigh commented 3 years ago

Hmm, the only token scope you should need is repos, do you have that scope set?

mvasigh commented 3 years ago

Closing this due to age.

MartinLesterSynamedia commented 2 years ago

I had the same issue and after much searching was directed here. I have cloned this repo into our GH Enterprise server so I can use it there as we can't use external repos on our internal system.

This error took me a while (longer than I'd like to admit) to work out. It turns out that all I had forgotten was to give the machine user, that is the owner of the token, permission to write to the repo I was trying to trigger the event on.

It is not mentioned in the README but I am sure it is the cause of this 404, because the default response for an end point in GitHub that you are not authorised to access is 404.

VincentGoLogic commented 2 years ago

Hi @MartinLesterSynamedia, I have the same issue. How did you give permissions to write to the repo you trying to trigger the event on?

Thank you

VincentGoLogic commented 2 years ago

Ok found it, my mistake was giving the url of the repo and not his name.