Closed airtonix closed 1 year ago
I don't know much about the merge queues but if it is effectively a way to act only on the pull request then I think it'd be fine to allow danger to generate the PR DSL when it is that action type. There's likely a declaration in the GitHub actions support about what types can generate it which you can add this to
( and I don't want .pr
to be nullable because that's annoying for the 95% case of people using danger on PRs, but GA support allows running on any event with the event JSON in there, details should either be on the docs page of the changelog )
well, the types should indicate reality: that pr
will not always be there.
@airtonix -- I think there's certain pragmatism necessary around our API types. It would be too inconvenient to make the common use-case(s) marked as optional, when in reality what we want to imply is "If PR should be there, then it is there".
If we follow your proposal to the logical conclusion, danger.github
isn't or shouldn't always present, particularly when we're running on GitLab, for example.
That said, I'd certainly support better types around Merge Queues! This is a new feature from Github so it's obviously not defined in our types or tooling yet. We're considering adopting them in our repo, so I may take a look at that. If you have any ideas, feel free to write a Feature Request ticket.
(I've closed this ticket since the behavior is "as designed" and you're advocating some kind of behavior change that would be better discussed in a non-bug ticket)
Describe the bug
when danger js is run from a workflow triggered by a mergequeue:
then:
will be undefined.
To Reproduce Steps to reproduce the behavior:
danger.github.pr.title
X
Y
intoX
danger.github.pr
is not defined.Expected behavior
The typescript types for
danger.github.pr
should be optional.Screenshots If applicable, add screenshots to help explain your problem.
Your Environment
github
| node | nodejs 16.17.0
| npm | pnpm 5.18.9
| Operating System | linux
Additional context Add any other context about the problem here.