Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 879caae

Browse files
committedApr 4, 2020
pull
1 parent d1ee573 commit 879caae

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed
 

‎index.js

+19-9
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ async function run() {
3939
} else {
4040
core.info("comment : disabled");
4141
}
42-
const pull = await octokit.pulls.get({
42+
const pull = await octokit?.pulls?.get({
4343
...context.repo,
4444
pull_number: context.payload.pull_request.number
45-
})
46-
core.info(pull)
47-
core.info(`ref : ${context.payload.pull_request.html_url}`)
45+
});
46+
if ( pull ) {
47+
core.debug(JSON.stringify(pull));
48+
core.debug(`ref : ${context.payload.pull_request.html_url}`);
49+
}
4850
}
4951

5052
async function setEnv() {
@@ -80,7 +82,15 @@ async function nowDeploy() {
8082
if (workingDirectory) {
8183
options.cwd = workingDirectory;
8284
}
83-
85+
let commitRef = context.ref;
86+
if (context.eventName === "pull_request") {
87+
//commitRef = context.payload.pull_request.number;
88+
//octokit.
89+
}
90+
let commitMessage = commit;
91+
if ( context.eventName === "pull_request") {
92+
//commitMessage =
93+
}
8494
await exec.exec(
8595
"npx",
8696
[
@@ -107,10 +117,10 @@ async function nowDeploy() {
107117
"-m",
108118
`githubCommitMessage=${commit}`,
109119
"-m",
110-
`githubCommitRef=${context.ref}`
111-
],
112-
options
113-
);
120+
`githubCommitRef=${commitRef}`
121+
],
122+
options
123+
);
114124

115125
return myOutput;
116126
}

0 commit comments

Comments
 (0)
Please sign in to comment.