File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -64,11 +64,25 @@ describe("PayloadHelper", () => {
6464 expect ( helper . getTemplateVariables ( ) ) . toStrictEqual ( expectedData ) ;
6565 } ) ;
6666 it ( "should be able to return pull request variables" , ( ) => {
67+ // @ts -ignore
6768 const context : Context < Webhooks . WebhookPayloadPullRequest > = {
6869 payload : {
6970 // @ts -ignore
7071 pull_request : {
7172 body : "pr_body" ,
73+ head : {
74+ ref : "test-branch" ,
75+ label : "" ,
76+ sha : "" ,
77+ // @ts -ignore
78+ repo : {
79+ id : 1 ,
80+ node_id : "1" ,
81+ name : "" ,
82+ full_name : "" ,
83+ private : false
84+ }
85+ } ,
7286 number : 5 ,
7387 labels : [ ] ,
7488 patch_url : "https://github.com/fossapps/Handlebars-Issue-and-Pull-Requests/pull/1.patch" ,
@@ -97,7 +111,8 @@ describe("PayloadHelper", () => {
97111 patch_url : "https://github.com/fossapps/Handlebars-Issue-and-Pull-Requests/pull/1.patch" ,
98112 issue_url : "https://github.com/fossapps/Handlebars-Issue-and-Pull-Requests/pull/1" ,
99113 html_url : "https://github.com/fossapps/Handlebars-Issue-and-Pull-Requests/pull/1" ,
100- diff_url : "https://github.com/fossapps/Handlebars-Issue-and-Pull-Requests/pull/1.diff"
114+ diff_url : "https://github.com/fossapps/Handlebars-Issue-and-Pull-Requests/pull/1.diff" ,
115+ branch : "test-branch"
101116 } ,
102117 id : 5
103118 } ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export interface ITemplateVars {
2121 diff_url : string ;
2222 patch_url : string ;
2323 issue_url : string ;
24+ branch : string ;
2425 } ;
2526 labels : WebhookPayloadIssuesIssueLabelsItem [ ] ;
2627}
@@ -55,7 +56,8 @@ export class PayloadHelper implements IPayloadHelper {
5556 diff_url : prPayload . pull_request . diff_url ,
5657 html_url : prPayload . pull_request . html_url ,
5758 issue_url : prPayload . pull_request . issue_url ,
58- patch_url : prPayload . pull_request . patch_url
59+ patch_url : prPayload . pull_request . patch_url ,
60+ branch : prPayload . pull_request . head . ref
5961 }
6062 } ;
6163 }
You can’t perform that action at this time.
0 commit comments