-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
My team has a large repo that's almost entirely code generated Python, and it's common for us to have very large PRs, as all the output is generated at once. We also generate unit tests for this code. Coverage hovers around 98%, and despite the huge amount of files/lines changed, the coverage metrics don't change much. It's useful to see the PR comment to catch cases where something changes unexpectedly.
python-coverage-comment-action failed on a recent PR, with the following stack trace. I haven't looked at the implementation, but the error message offers two alternative ways to generate the diff, and I thought I'd mention it. We've disabled the GitHub action for now, so this is not a critical issue.
Error: Critical error. This error possibly occurred because the permissions of the workflow are set incorrectly. You can see the correct setting of permissions here: https://github.com/py-cov-action/python-coverage-comment-action#basic-usage
Otherwise please look for open issues or open one in https://github.com/py-cov-action/python-coverage-comment-action/
Traceback (most recent call last):
File "/workdir/coverage_comment/github_client.py", line 89, in _http
response.raise_for_status()
File "/usr/local/lib/python3.12/site-packages/httpx/_models.py", line 829, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '406 Not Acceptable' for url 'https://api.github.com/repos/<redacted>/pulls/164'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/workdir/coverage_comment/main.py", line 46, in main
exit_code = action(
^^^^^^^
File "/workdir/coverage_comment/main.py", line 98, in action
return process_pr(
^^^^^^^^^^^
File "/workdir/coverage_comment/main.py", line 143, in process_pr
diff = github.get_pr_diff(
^^^^^^^^^^^^^^^^^^^
File "/workdir/coverage_comment/github.py", line 266, in get_pr_diff
.get(headers={"Accept": "application/vnd.github.v3.diff"})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workdir/coverage_comment/github_client.py", line 29, in __call__
return self._gh._http(self._method, self._path, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workdir/coverage_comment/github_client.py", line 96, in _http
raise cls(str(contents)) from exc
coverage_comment.github_client.ApiError: {'message': "Sorry, the diff exceeded the maximum number of files (300). Consider using 'List pull requests files' API or locally cloning the repository instead.", 'errors': [{'resource': 'PullRequest', 'field': 'diff', 'code': 'too_large'}], 'documentation_url': 'https://docs.github.com/rest/pulls/pulls#list-pull-requests-files', 'status': '406'}
Metadata
Metadata
Assignees
Labels
No labels