Skip to content

Commit 2997047

Browse files
committed
- fixed env
1 parent 1144900 commit 2997047

File tree

1 file changed

+12
-47
lines changed

1 file changed

+12
-47
lines changed

index.js

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,18 @@ const getDeployPayloads = async (context, { owner, repo, pullNumber, sha = '' },
136136
gitVersion = version;
137137
}
138138
const description = `Deploy ${chart} for ${repo}/pull/${pullNumber}`;
139-
const environment = `${name}-pull-${pullNumber}`;
140-
return [...val, { repo, component: name, gitVersion, version, chart, description, environment, domain, action: 'deploy' }];
139+
const environment = `${repo}-pull-${pullNumber}`;
140+
return [...val, {
141+
repo,
142+
component: name,
143+
gitVersion,
144+
version,
145+
chart,
146+
description,
147+
environment,
148+
domain,
149+
action: 'deploy'
150+
}];
141151
}, Promise.resolve([]));
142152
}
143153

@@ -187,18 +197,6 @@ const createDeployments = async (app, context, owner, payloads) => {
187197
production_environment: false, // Specifies if the given environment is one that end-users directly interact with.
188198
});
189199
app.log.info(`Created deployment #${res.data.id} for pull request ${environment}`);
190-
191-
const deploymentId = res.data.id;
192-
await context.octokit.repos.createDeploymentStatus({
193-
owner,
194-
repo: 'charts',
195-
deployment_id: deploymentId,
196-
state: 'pending', // The state of the status. Can be one of error, failure, inactive, pending, or success
197-
description, // A short description of the status.
198-
environment,
199-
environment_url: `https://${environment}.${domain}`, // Sets the URL for accessing your environment.
200-
auto_inactive: true, // Adds a new inactive status to all prior non-transient, non-production environment deployments with the same repository and environment name as the created status's deployment. An inactive status is only added to deployments that had a success state.
201-
});
202200
});
203201
};
204202

@@ -302,39 +300,6 @@ module.exports = (app) => {
302300
await createDeployments(app, context, owner, payloads);
303301
},
304302
);
305-
// app.on(
306-
// "deployment_status",
307-
// async (context) => {
308-
// app.log.info('deployment_status');
309-
// app.log.info(context.payload);
310-
// },
311-
// );
312-
app.on(
313-
"status",
314-
async (context) => {
315-
const {
316-
state,
317-
context: ctx,
318-
commit: { sha },
319-
repository: { owner: { login: owner }, name: repo },
320-
} = context.payload;
321-
if (state !== 'success' || !ctx || ctx.toString().match(/publish/) === null) {
322-
return;
323-
}
324-
app.log.info('status');
325-
app.log.info({ state, owner, repo, sha, ctx });
326-
await syncConfig(context, owner);
327-
328-
const pullNumber = await findOpenPullRequestNumber(context, owner, repo, sha);
329-
if (!pullNumber) {
330-
app.log.debug(`Open pull request for sha ${sha} cannot be find. Deploy dismissed.`);
331-
return;
332-
}
333-
334-
const payloads = await getDeployPayloads(context, { owner, repo, pullNumber, sha });
335-
await createDeployments(app, context, owner, payloads);
336-
},
337-
);
338303
app.on(
339304
"push",
340305
async (context) => {

0 commit comments

Comments
 (0)