readthedocs.org
33af3260 - GitHub App: post comments on PRs (#12230)

Commit
168 days ago
GitHub App: post comments on PRs (#12230) - The FileTreeDiff dataclass was changed to a normal class, to make it easier to interact with its contents in a dynamic way. - Since a new FileTreeDiffFile class was introduced, the old one was renamed to FileTreeDiffManifestFile, since it's a class only used in the manifest dataclass. - The comment is posted after the manifest from the PR is created, since it depends on having the manifest ready to get the diff. - The application creates one comment per-project linked to the remote repository. First I tried including the information of several projects in one single comment, but I think it's better for each project to have their own comment (so users get the notification for when each build is done). - There is a new option in the project model, so users can decide if this feature should be enabled. This option is hidden for projects not linked to a GH app. I tried using the pre-validation form thing, but it isn't per-field, and it blocks the whole form from saving. - Try/catch around the indexers, so if one fails, we can still get the build overview posted. - For the comment, I took some inspiration from https://docs.codecov.com/docs/pull-request-comments and from my initial ideas around the UI for FTD. My vision is to keep the comment minimal, but still have all the information available if needed. This means that all metadata is either hidden or one-liner, while the list of top files changed is a list. The list of all files changed is included in a table, so we can add more information if needed (I'm envisioning putting here a redirect suggestion, for example), and also should be search friendly, so users can easily search all files that are marked as changed/added/deleted. - Should the comment also respect the ignore patterns from the addon config? It's also kind of confusing that we have these settings in two places... in addons and in the PR form. - The list of the top 5 files changed is literally the 5 files from the diff (sorted). I was also playing around with maybe taking one file from each category (added/modifed/deleted), but will see how useful is just having the top first. You can see a live example at https://github.com/stsewd/rtd-test-builds/pull/1#issuecomment-3001440422. ![Screenshot 2025-06-24 at 20-08-57 Update index rst by stsewd · Pull Request #1 · stsewd_rtd-test-builds](https://github.com/user-attachments/assets/fe68a161-128b-4521-880d-de6b58e69365) Closes https://github.com/readthedocs/readthedocs.org/issues/11780
Author
Parents
Loading