Conversation
|
Edmond Luo seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
The pr test data json seems incorrect, when a pr is not merged Which causing the all the 3 cases are failing. |
I cannot speak to the implementation, but I can confirm the webhook payloads in the testdata folder are real payloads that were captured directly from github. |
scm/driver/github/testdata/pr.json
Outdated
| }, | ||
| "merge_commit_sha": "e5bd3914e2e596debea16f433f57875b5b90bcd6", | ||
| "merged": false, | ||
| "merged": true, |
There was a problem hiding this comment.
the json payload in pr.json is for an open pull request; therefore it should not be set to merged: true. I would instead suggest adding a new, real world json file and creating a new test case. I think you will find our existing merged_at logic works as expected if you provide it with a real world payload for a merged action.
There was a problem hiding this comment.
I tested on my own repo, the merged and merge_at are always marked or filled in the case of merged-pr. And both not marked or filled in the case of closed-pr and opening-pr.
There was a problem hiding this comment.
I think there may be a misunderstanding. The pr.json file is for an open pull request (the state field is set to open) which means it cannot have merged set to true. If you want to create a test case for a merged pull request, you should add a new file, for example pr_merged.json; this should be a real json payload captured from github, not something modified by hand.
There was a problem hiding this comment.
Hmmm, it the pr.json is for a opening-pr, then its merge_at must be null. If it is not merged (opening), how can it have a merge time... So I think something in the pr.json must be wrong.
But having another test json (maybe pr_merged.json) make sense.
Referring: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
A merge action can be found in the close action hook.