File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -10,18 +10,23 @@ const main = async () => {
1010
1111 const { context } = github ;
1212
13- console . log ( `Commit: "${ context . sha } ` ) ;
14- console . log ( JSON . stringify ( context ) ) ;
13+ console . log ( `Commit: "${ context . sha } "` ) ;
1514
16- const octokit = github . getOctokit ( process . env . TOKEN ) ;
15+ let prBody ;
1716
18- const { data } = await octokit . repos . listPullRequestsAssociatedWithCommit ( {
19- owner : context . repo . owner ,
20- repo : context . repo . repo ,
21- commit_sha : context . sha ,
22- } ) ;
17+ if ( context . pull_request ) {
18+ prBody = context . pull_request . body ;
19+ } else {
20+ const octokit = github . getOctokit ( process . env . TOKEN ) ;
2321
24- const prBody = data [ 0 ] . body ;
22+ const { data } = await octokit . repos . listPullRequestsAssociatedWithCommit ( {
23+ owner : context . repo . owner ,
24+ repo : context . repo . repo ,
25+ commit_sha : context . sha ,
26+ } ) ;
27+
28+ prBody = data [ 0 ] . body ;
29+ }
2530
2631 core . endGroup ( ) ;
2732
You can’t perform that action at this time.
0 commit comments