get-release icon indicating copy to clipboard operation
get-release copied to clipboard

RequestError [HttpError]: Not Found

Open djonasdev opened this issue 4 years ago • 6 comments

I have a problem using the sample. I get the following error if I want to use your action in my workflow. Can you please help me getting this sample working?

foo.yml

      - name: Get release
        id: get_release
        uses: bruceadams/[email protected]
        env:
          GITHUB_TOKEN: ${{ github.token }}
Run bruceadams/[email protected]
RequestError [HttpError]: Not Found
    at /home/runner/work/_actions/bruceadams/get-release/v1.2.2/dist/index.js:7474:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async run (/home/runner/work/_actions/bruceadams/get-release/v1.2.2/dist/index.js:24906:32) {
  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: 'Mon, 12 Oct 2020 06:51:22 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-content-type-options': 'nosniff',
    'x-frame-options': 'deny',
    'x-github-media-type': 'github.v3; format=json',
    'x-github-request-id': '0403:592E:206BC5B:338319B:5F83FCEA',
    'x-ratelimit-limit': '1000',
    'x-ratelimit-remaining': '999',
    'x-ratelimit-reset': '1602489082',
    'x-ratelimit-used': '1',
    'x-xss-protection': '1; mode=block'
  },
  request: {
    method: 'GET',
    url: 'https://api.github.com/repos/dojo90/Playground/releases/tags/refs/heads/master',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit.js/16.43.2 Node.js/12.13.1 (Linux 5.4; x64)',
      authorization: 'token [REDACTED]'
    },
    request: { hook: [Function: bound bound register], validate: [Object] }
  },
  documentation_url: 'https://docs.github.com/rest/reference/repos#get-a-release-by-tag-name'
}
Error: Not Found

djonasdev avatar Oct 12 '20 06:10 djonasdev

Ah I figured it out! ~~If you do not set a release name, you get the error message. If you set a release name. It works like it should~~ If you run it on a commit and not on a tag pipeline, you get this error message

djonasdev avatar Oct 12 '20 07:10 djonasdev

This is a wonderful example of how I (and others) fail when explaining something we are deep inside of. What I don't appear to say anywhere in the README is how a specific release is chosen. The opening bit of the example:

on:
  release:
    types: [created]

that is triggering on a release (it doesn't have to be created other types, such as created should work just as well), is important. With that trigger on … release the job is run with the context of the specific release that triggered the run.

Now I need to figure out how to make that clearer in the README. Might you have any suggestions for making that clearer?

bruceadams avatar Oct 12 '20 17:10 bruceadams

From the beginning I understood the action so that it would be possible to get the last release (regardless of when it was triggered). That I have to apply it absolutely and exclusively to the tag/release pipeline does not come from the readme (as you already said). For example, I use the following introduction to make it work:

on:
  push:
    tags:
      - '*'

Perhaps it would make sense to generate a separate error message first that contains something like the following message: "Tag/Release pipeline used? -> see readme: https://github.com/bruceadams/get-release#example-workflow"

Is it technically not possible to get the latest release via the API?


I would put the following note in the readme: Action is only working if you run it on a tag/release pipeline, as the action needs the release context.

working:

on:
  push:
    tags:
      - '*'
on:
  release:
    types: [created]

not working

on: 
  push:
  pull_request:

djonasdev avatar Oct 13 '20 06:10 djonasdev

This action also doesn't work if the release you're looking for is a draft.

tubbo avatar Sep 15 '21 18:09 tubbo

So how can I fix this error in my project? I have setup:

on:
  push:
    tags:
      - '*'

and then execute:

git tag v1.3
git push origin v1.3

then failed with 404, I use version is: bruceadams/[email protected]

zhan-ge avatar Dec 23 '21 03:12 zhan-ge

Is there any way to get this working from a dispatch_workflow? -- I'd like to pass some other information into the build pipeline so I can't do it on tag / release creation in the cloud GUI

jakemumu avatar Feb 24 '23 07:02 jakemumu