actions / create-github-app-token

GitHub Action for creating a GitHub App Installation Access Token
https://github.com/marketplace/actions/create-github-app-token
MIT License
309 stars 43 forks source link

Feature suggestion: Log the x-github-request-id #152

Open gm3dmo opened 1 week ago

gm3dmo commented 1 week ago

Would be nice if there was someway of logging the x-github-request-id header.

It would be helpful to have this in cases where the attempt to get a token from app/installations//access_tokens fails with a "Network Error" where it fails to reach api.github.com for some reason versus any case when GitHub.com is responding with an error.

gr2m commented 1 week ago

The x-github-request-id header is set on responses. If we cannot reach api.github.com, we do not have the x-github-request-id response header, or am I missing something?

gm3dmo commented 6 days ago

There are 3 cases:

  1. Client requests access token and receives it. In this case the x-github-request-id can be logged.
  2. Client requests access token and receive an error from GitHub. In this case the x-github-request-id can be logged and is super useful for zooming in on logs.
  3. Client makes a request (possibly through some maze of proxies) and receives no response whatsoever. This makes it easier to point at the network as the place to begin troubleshooting.

Many litres of tears and escalations may be saved with this precious knowledge.

gr2m commented 6 days ago

For case 2., in case of a request error, it should log the full request + response (with credentials redacted), it's the standard @octokit behavior. Do you have an example build where actions/create-github-app-token failed? It would be helpful to see logs

For case 1., we can add that if it's helpful, pull request welcome

For 3., a similar error should be logged as in 2., only lacking a response property