Skip to content

Commit

Permalink
feat: create github deployment
Browse files Browse the repository at this point in the history
Signed-off-by: Minsu Lee <amond@amond.net>
  • Loading branch information
amondnet committed Oct 13, 2020
1 parent f632520 commit ae1ebea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1426,12 +1426,13 @@ async function createGithubDeployment() {
return null;
}

async function createGithubDeploymentStatus(deploymentId, status) {
async function createGithubDeploymentStatus(deploymentId, status, logUrl) {
if (githubDeployment && deploymentId && status && octokit) {
await octokit.repos.createDeploymentStatus({
...context.repo,
deployment_id: deploymentId,
state: status,
log_url: logUrl,
});
}
}
Expand Down Expand Up @@ -1475,7 +1476,11 @@ async function run() {
}
const deploymentUrl = await vercelDeploy(ref, commit);
if (githubDeploymentId) {
await createGithubDeploymentStatus(githubDeploymentId, 'success');
await createGithubDeploymentStatus(
githubDeploymentId,
'success',
deploymentUrl,
);
}
if (deploymentUrl) {
core.info('set preview-url output');
Expand Down
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,13 @@ async function createGithubDeployment() {
return null;
}

async function createGithubDeploymentStatus(deploymentId, status) {
async function createGithubDeploymentStatus(deploymentId, status, logUrl) {
if (githubDeployment && deploymentId && status && octokit) {
await octokit.repos.createDeploymentStatus({
...context.repo,
deployment_id: deploymentId,
state: status,
log_url: logUrl,
});
}
}
Expand Down Expand Up @@ -378,7 +379,11 @@ async function run() {
}
const deploymentUrl = await vercelDeploy(ref, commit);
if (githubDeploymentId) {
await createGithubDeploymentStatus(githubDeploymentId, 'success');
await createGithubDeploymentStatus(
githubDeploymentId,
'success',
deploymentUrl,
);
}
if (deploymentUrl) {
core.info('set preview-url output');
Expand Down

0 comments on commit ae1ebea

Please sign in to comment.