rust-lang / triagebot

Automation/tooling for Rust spaces
https://triage.rust-lang.org
Apache License 2.0
170 stars 74 forks source link

Fix RFC rendered linkifier. #1646

Closed ehuss closed 1 year ago

ehuss commented 1 year ago

The RFC "Rendered" link generator wasn't working. The problem is that the Push event wasn't marking the payload as a PR. When the link generator was looking for the list of files, the files method was returning nothing.

I removed the empty PullRequestDetails struct since I don't foresee that ever gaining any fields (the fields usually are part of Issue). I think the bool makes the meaning a little clearer.

Additionally I changed the format of the link URL. I prefer to have links directly to the author's branch so that it can reliably display the latest content. Linking to the SHA blob URL risks that the link gets out of date and reviewers may be looking at stale content. The drawback with the branch-based approach is that the link will die when the branch is deleted or reset. I think that is relatively good tradeoff, as I think the Rendered link should be updated when the RFC is closed. Perhaps that can be automated in the future.

Finally, I added some comments along the way to help understand what all these structs/fields/variants are doing.