From 0725211c2129b03e2166cb3cfc45aeb34d40d609 Mon Sep 17 00:00:00 2001 From: Minsu Lee Date: Sat, 4 Apr 2020 19:03:20 +0900 Subject: [PATCH] pull --- index.js | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 96c74ae..454766d 100644 --- a/index.js +++ b/index.js @@ -39,12 +39,15 @@ async function run() { } else { core.info("comment : disabled"); } - const pull = await octokit.pulls.get({ - ...context.repo, - pull_number: context.payload.pull_request.number - }) - core.info(pull) - core.info(`ref : ${context.payload.pull_request.html_url}`) + if ( octokit ) { + const pull = await octokit.pulls.get({ + ...context.repo, pull_number: context.payload.pull_request.number + }); + if (pull) { + core.debug(JSON.stringify(pull)); + core.debug(`ref : ${context.payload.pull_request.html_url}`); + } + } } async function setEnv() { @@ -80,7 +83,15 @@ async function nowDeploy() { if (workingDirectory) { options.cwd = workingDirectory; } - + let commitRef = context.ref; + if (context.eventName === "pull_request") { + //commitRef = context.payload.pull_request.number; + //octokit. + } + let commitMessage = commit; + if ( context.eventName === "pull_request") { + //commitMessage = + } await exec.exec( "npx", [ @@ -107,10 +118,10 @@ async function nowDeploy() { "-m", `githubCommitMessage=${commit}`, "-m", - `githubCommitRef=${context.ref}` - ], - options - ); + `githubCommitRef=${commitRef}` + ], + options + ); return myOutput; }