-
Notifications
You must be signed in to change notification settings - Fork 736
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
pull_request action "edited": changes #979
pull_request action "edited": changes #979
Conversation
@SuppressFBWarnings("UWF_UNWRITTEN_FIELD") | ||
public class GHPullRequestChanges { | ||
|
||
private GHCommitPointer base; |
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.
base
changed - covered with UT
title
changed - covered with UT
body
changed - cover on demand
assertThat(event.getPullRequest().getTitle(), is("REST-276 - easy-random")); | ||
assertThat(event.getChanges().getBase().getRef().getFrom(), is("develop")); | ||
assertThat(event.getChanges().getBase().getSha().getFrom(), is("4b0f3b9fd582b071652ccfccd10bfc8c143cff96")); | ||
assertThat(event.getPullRequest().getBody(), startsWith("**JIRA Ticket URL:**")); |
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.
body not changed - hence "changes"
does not contain it
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.
Minor changes to test.
assertThat(event.getChanges().getBase(), nullValue()); | ||
assertThat(event.getPullRequest().getBody(), startsWith("**JIRA Ticket URL:**")); | ||
assertThat(event.getChanges().getBody(), nullValue()); | ||
assertThat(event.getChanges(). getChanges(), nullValue()); |
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.
assertThat(event.getChanges(). getChanges(), nullValue()); |
@bitwiseman not sure what changes did you expect. My logic was: for three fields: |
Description
Webhook with
X-GitHub-Event: pull_request
and"action": "edited"
has a field"changes"
that is not present inGHEventPayload.PullRequest
. I've found three triggers that leads to "edited" action:(full payload - in test data)
So,
"changes"
fields contain old value that was changed, whilepull_request
object has latest values (see UT json payloads). Any other changes of a PR in GitHub UI leads to other types of notifications (e.g.action
isassigned
orready_for_review
orlabeled
).