Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More meaningful error message if commenting fails, and perhaps retry #96

Open
Piedone opened this issue Nov 26, 2022 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@Piedone
Copy link

Piedone commented Nov 26, 2022

Recently, running the workflow failed in our repo, see the workflow output, with the following error:

Error: error adding "This pull request has merge conflicts. Please resolve those before requesting a review.": HttpError: invalid json response body at https://api.github.com/repos/Lombiq/Open-Source-Orchard-Core-Extensions/issues/291/comments reason: Unexpected end of JSON input
    at /home/runner/work/_actions/eps1lon/actions-label-merge-conflict/9[29](https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions/actions/runs/3554453936/jobs/5970562928#step:3:31)24ba33a60e436034b0ac3838de523bf7df071/dist/index.js:7594:23
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/_actions/eps1lon/actions-label-merge-conflict/92924ba33a60e436034b0ac3838de523bf7df071/dist/index.js:7364:65)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

I suspect this was due to a temporary issue with the GitHub web API, because re-running the workflow succeeded, and the action perfectly updated only those PRs that needed it.

My request would be to please consider adding a more meaningful error message in such cases, e.g. (if this is indeed a GH API error) something along the lines of "Error: error adding "This pull request has merge conflicts. Please resolve those before requesting a review." due to an invalid response from the GitHub API. This is most possibly just a temporary issue; try re-running the action. Don't worry, it won't duplicate labels or comments."

Ideally, there would also be some retry logic, so the action would back off for like a second, then try again, then back off for 3 second and try again, and if that still fails, then fail with an error message like "Error: error adding "This pull request has merge conflicts. Please resolve those before requesting a review." due to an invalid response from the GitHub API, even after 3 attempts. This is most possibly just a temporary issue; try re-running the action in a few minutes. Don't worry, it won't duplicate labels or comments."

@eps1lon
Copy link
Owner

eps1lon commented Nov 27, 2022

This is most possibly just a temporary issue;

How would I know that?

Implementing back-off logic for rare, one-off issues sounds like a lot of work for little gain. Still, would happily review a PR.

@eps1lon eps1lon added the enhancement New feature or request label Nov 27, 2022
@Piedone
Copy link
Author

Piedone commented Nov 27, 2022

Since on a second try the same comment succeeded, it was indeed a temporary error. I only see the above-mentioned error message so I don't know what exactly the response was, but the action could check the HTTP response code (before trying to parse the response) and if it's a 5xx only then display this message.

GitHub doesn't have a stellar incident history lately, so I'd argue this is not necessarily a one-off issue (as it is a useful practice to treat remote APIs as potentially unreliable generally) but I don't want to imply it's a huge one either. Such retry would be more like a nice-to-have thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants