Giter Site home page Giter Site logo

Comments (13)

gr2m avatar gr2m commented on May 28, 2024 2

Glad you got it working!

🤔 we could compare the path to all known pats based on the OpenAPI spec, might have saved you and probably many others lots of headaches. We could log a warning? What do you think

from request-action.

gr2m avatar gr2m commented on May 28, 2024

There was a lock file update in that time frame. Can you check if the error persist with the prior version (01a594f)

octokit/request-action@01a594f812f65f72258093beb52b2b89429eb853

from request-action.

rishubil avatar rishubil commented on May 28, 2024

I just applied and tested it, but It's still the same.
When the problem occurred, I was using a specific version(octokit/[email protected]) so I don't think it's an issue related to that.

I think I should test it using curl directly in github action.

from request-action.

rishubil avatar rishubil commented on May 28, 2024

I tried to use curl by accessing github action with ssh using debugging-with-tmate.
I have checked that 204 will be returned normally if requested by curl.
It's hard to understand why this is happening, is there anything else I can test?

from request-action.

gr2m avatar gr2m commented on May 28, 2024

I tried to reproduce your problem, but no luck.

Here is my workflow file:

https://github.com/gr2m/sandbox/blob/5e75f95f76825b8bc402916f16207dbfa4866ad4/.github/workflows/debug.yml

Here is the action run

https://github.com/gr2m/sandbox/runs/1963580718

I'm running out of ideas what the problem might be. Can you try this?

      - uses: octokit/[email protected]
        with:
          route: GET /repos/:repository/collaborators/rishubil 
          repository: ${{ github.repository }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

If that is failing, can you copy and past my debug.yml file into your repository and run the workflow using the manual dispatch? Make sure to replace gr2m with rishubil

If that's all failing, I'd suggest you contact support, they will be able to help you better: https://support.github.com/contact

from request-action.

rishubil avatar rishubil commented on May 28, 2024

I don't know why, but about 9 hours ago, github action started returning 204 normally!
Perhaps it was an issue of github action itself.

Thank you for your kind response.

from request-action.

gr2m avatar gr2m commented on May 28, 2024

no worries! Glad to hear it's all working again!

from request-action.

praneetloke avatar praneetloke commented on May 28, 2024

Apologies for commenting on a closed issue but I seem to be running into this. No matter what I do the action always fails with a 404 and nothing in the debug logs looks out-of-place.

Logs
0s
##[debug]Evaluating: secrets.GITHUB_TOKEN
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'GITHUB_TOKEN'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating condition for step: 'Run octokit/[email protected]'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run octokit/[email protected]
##[debug]Loading inputs
##[debug]Evaluating: format('GET /repos/:repository/releases/{0}', env.RELEASE_TAG)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> 'GET /repos/:repository/releases/{0}'
##[debug]..Evaluating Index:
##[debug]....Evaluating env:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'RELEASE_TAG'
##[debug]..=> 'v0.0.47'
##[debug]=> 'GET /repos/:repository/releases/v0.0.47'
##[debug]Result: 'GET /repos/:repository/releases/v0.0.47'
##[debug]Evaluating: github.repository
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'repository'
##[debug]=> 'praneetloke/[redactedRepo]'
##[debug]Result: 'praneetloke/[redactedRepo]'
Warning: Unexpected input(s) 'repository', valid inputs are ['route', 'mediaType']
##[debug]Loading env
Run octokit/[email protected]
GET /repos/:repository/releases/v0.0.47
> repository: praneetloke/[redactedRepo]
> mediaType: [object Object]
##[debug]route: 'GET /repos/:repository/releases/v0.0.47'
##[debug]parameters: { repository: 'praneetloke/[redactedRepo]', mediaType: {} }
##[debug]parsed request options: {
##[debug]  method: 'GET',
##[debug]  headers: {
##[debug]    accept: 'application/vnd.github.v3+json',
##[debug]    'user-agent': 'octokit-action.js/3.7.1 octokit-core.js/3.4.0 Node.js/12.13.1 (linux; x64)'
##[debug]  },
##[debug]  request: { hook: [Function: bound bound register] },
##[debug]  data: undefined,
##[debug]  url: 'https://api.github.com/repos/praneetloke/[redactedRepo]/releases/v0.0.47'
##[debug]}
< 404 159ms

::set-output name=status::404
##[debug]steps.get_release.outputs.status='404'
##[debug]RequestError [HttpError]: Not Found
##[debug]    at /home/runner/work/_actions/octokit/request-action/v2.x/dist/index.js:6251:23
##[debug]    at processTicksAndRejections (internal/process/task_queues.js:93:5)
##[debug]    at async main (/home/runner/work/_actions/octokit/request-action/v2.x/dist/index.js:404:39) {
##[debug]  name: 'HttpError',
##[debug]  status: 404,
##[debug]  headers: {
##[debug]    'access-control-allow-origin': '*',
##[debug]    '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',
##[debug]    connection: 'close',
##[debug]    'content-encoding': 'gzip',
##[debug]    'content-security-policy': "default-src 'none'",
##[debug]    'content-type': 'application/json; charset=utf-8',
##[debug]    date: 'Wed, 29 Dec 2021 15:12:02 GMT',
##[debug]    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
##[debug]    server: 'GitHub.com',
##[debug]    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
##[debug]    'transfer-encoding': 'chunked',
##[debug]    vary: 'Accept-Encoding, Accept, X-Requested-With',
##[debug]    'x-content-type-options': 'nosniff',
##[debug]    'x-frame-options': 'deny',
##[debug]    'x-github-media-type': 'github.v3; format=json',
##[debug]    'x-github-request-id': '07C0:340E:3711DF4:78398FE:61CC7AC2',
##[debug]    'x-ratelimit-limit': '1000',
##[debug]    'x-ratelimit-remaining': '983',
##[debug]    'x-ratelimit-reset': '1640793446',
##[debug]    'x-ratelimit-resource': 'core',
##[debug]    'x-ratelimit-used': '17',
##[debug]    'x-xss-protection': '0'
##[debug]  },
##[debug]  request: {
##[debug]    method: 'GET',
##[debug]    url: 'https://api.github.com/repos/praneetloke/[redactedRepo]/releases/v0.0.47',
##[debug]    headers: {
##[debug]      accept: 'application/vnd.github.v3+json',
##[debug]      'user-agent': 'octokit-action.js/3.7.1 octokit-core.js/3.4.0 Node.js/12.13.1 (linux; x64)',
##[debug]      authorization: 'token [REDACTED]'
##[debug]    },
##[debug]    request: { hook: [Function: bound bound register] }
##[debug]  },
##[debug]  documentation_url: 'https://docs.github.com/rest/reference/repos#get-a-release'
##[debug]}

I tried creating a new PAT with the repo scope and using that and yet I can't seem to be able to call the /releases API using this GH action. The same token works just fine when I make a curl request directly.

from request-action.

gr2m avatar gr2m commented on May 28, 2024

Most likely an authentication problem. What do you pass as GITHUB_TOKEN? If you set it to ${{ secrets.GITHUB_TOKEN }}, is the request going to the same repository where you run the action? If not, then you will need a different means of authentication

from request-action.

praneetloke avatar praneetloke commented on May 28, 2024

Yeah the request is going to the same repo which is private. Suspecting a problem with the token perms, I created a new PAT and mapped that to GITHUB_TOKEN in the env map for the step. That still does not work with this action. As noted in my earlier comment, I can make the API call manually using curl with that new token just fine.

from request-action.

praneetloke avatar praneetloke commented on May 28, 2024

🤦‍♂️ so it was my fault. The action is working just fine. I was calling the wrong URL in the action. To be able to get a release by a tag, the correct endpoint is repos/:repository/releases/tags/:tag_name. When I ran the curl test I ran one from my command history where I evidently had the correct URL. I can't tell you how silly I feel right now!

from request-action.

praneetloke avatar praneetloke commented on May 28, 2024

@gr2m hmm I don't think I follow...

from request-action.

gr2m avatar gr2m commented on May 28, 2024

Here is how it would work in case anyone wants to work on it:

The setup would work similar to how https://github.com/octokit/plugin-paginate-rest.js updates src/generated/paginating-endpoints.ts.

  1. Create an update workflow like octokit/plugin-paginate-rest.js:.github/workflows/update.ym
  2. Create an update-endpoints script that will take the OpenAPI specification from @octokit/openapi, create/update a generated/rest-api-routes.js file, which would be an array of all REST API routes that GitHub supports
  3. When sending a request, compare the given route to the known routes defined in generated/rest-api-routes.js. If the route is unknown, log a warning if the response is a 404.

No worries if that doesn't make sense @praneetloke, there is lots of inside knowledge behind how the automated updates work for the@octokit/* packages based updates to GitHub's OpenAPI specifications

from request-action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.