Open clayton-duarte opened 5 months ago
Sure, you're welcome to add it
Thanks for the quick reply @orta !
I'll be very happy to contribute, I just have a question before start working on a PR.
I was checking the codebase and found out Danger uses github's REST API. With that in mind, I was checking their documentation and I have not-so-good news. They do not have a proper enum for that field:
https://docs.github.com/en/rest/pulls/reviews#get-a-review-for-a-pull-request
So, my suggestion is to simply change GitHubReview.state
to string
and add some examples as a comment.
What do you suggest?
from their response schema:
"state": {
"type": "string",
"examples": [
"CHANGES_REQUESTED"
]
},
Maybe change it to be the existing literal array with | string
at the end so that people can get a sense but not be complacent?
Describe the bug
The current
GitHubReview.state
type definition is"APPROVED" | "REQUEST_CHANGES" | "COMMENT" | "PENDING" | undefined.
But while trying to catch if a PR had any requested changes I found out that the state returned by GitHub is actually
CHANGES_REQUESTED
.To Reproduce
Steps to reproduce the behavior:
dangerfile
check the return ofreviews.find((review) => review.state === 'REQUEST_CHANGES')
;reviews.find((review) => review.state === 'CHANGES_REQUESTED')
;Expected behavior
GitHubReview.state
type should correctly reflect the expected strings from GitHub;Screenshots If applicable, add screenshots to help explain your problem.
Your Environment
Additional context I've checked the most recent
danger
releases and the latest12.1.0
release still presents this issue.