Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tester GH commands #20

Merged
merged 1 commit into from
Mar 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions scripts/deployments.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,31 @@ module.exports = async function(robot) {
msg.send("Once this build is complete, you will be able to issue an appropriate !deploy command:", buildInfo.build_url);
});

robot.hear(/!build gh (backend|frontend) ([0-9a-fA-f]*)( dev)?/, async msg => {
const formData = {
'event_type': `Build ${msg.match[1]} request from Chewie`,
'client_payload':{
JOB: `build-${msg.match[1]}-image`,
COMMIT_HASH: msg.match[2]
}
}
if (msg.match[3]){
formData['client_payload[DEV]'] = "true";
}
await request({
method: 'POST',
uri: `https://api.github.com/repos/area/colony-deployment-scripts/dispatches`,
keepAlive: false,
body: JSON.stringify(formData),
headers:{
"Accept": "application/vnd.github.everest-preview+json",
"Authorization": `token ${process.env.HUBOT_GITHUB_TOKEN}`,
"User-Agent": "JoinColony/chewie",
}
});
msg.send("Keep an eye on the build here: https://github.com/area/colony-deployment-scripts/actions . Once complete, you will be able to issue and appropriate !deploy command")
});

async function output(msg, res){
if (res.stdout) {
msg.send(`Stdout:
Expand Down