Skip to content

Commit

Permalink
fix: Only set env + env url if set
Browse files Browse the repository at this point in the history
  • Loading branch information
colinjfw committed Oct 31, 2019
1 parent 49972ce commit 7ed2652
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ async function run() {
const envUrl = core.getInput("environment-url", {required: false});

const client = new github.GitHub(token);

await client.repos.createDeploymentStatus({
const params = {
...context.repo,
deployment_id: context.payload.deployment.id,
state,
log_url: url,
target_url: url,
environment: env,
environment_url: envUrl,
description,
});
};
if (env) {
params.environment = env;
}
if (envUrl) {
params.environment_url = envUrl;
}
await client.repos.createDeploymentStatus(params);
} catch (error) {
core.error(error);
core.setFailed(error.message);
Expand Down

0 comments on commit 7ed2652

Please sign in to comment.