-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support github pull request merge action #117
base: master
Are you sure you want to change the base?
Conversation
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
@@ -371,7 +371,7 @@ | |||
"site_admin": false | |||
}, | |||
"merge_commit_sha": "e5bd3914e2e596debea16f433f57875b5b90bcd6", | |||
"merged": false, | |||
"merged": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.