danger / danger/peril

milestoned and demilestoned events handling

Open
#341 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
460
Forks
55
PR merge metrics
No merged PRs in 30d

Description

So, github sends the "milestoned" and "demilestoned" events (setting or unsetting the milestone) for pull requests as issue events.. thus the rules for peril don't quite work as all will show up as issue events even if they are pull requests.

I believe we can perform a "workaround" though.
in the payload under "issue" there is a pull_request node that is set if the issue is an actual PR. So we could use that to detect that it is, in-fact, a PR and fake the event to be pull_request instead.

I'm thinking (from skimming the code) that this might be doable in github_runner.ts#runsForEvent and "correct" the event as pull_request

abbreviated webhook payload for milestoned
```javascript
{
"action": "milestoned",
"issue": {
"number": 123,
"title": "my PR title",
// other attributes (assignees, labels, user, etc..updated_at, created_at, etc..)
"milestone": {
// new milestone of PR
},
// how we can detect it is a pull request
"pull_request": {
// various pull request URLs
},
"body": "my description"
},
"repository": {
// repository details
},
"organization": {
"login": "myorg",
// other org data
},
"sender": {
"login": "sender",
// other sender data
},
"installation": {
"id": 12345
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.