Automatic importing on Git push
ou can make automatic bot deploying on git push.
This possible with Webhooks. Make install for this lib.

Setup

command /setupGit
1
var url = Libs.Webhooks.getUrlFor(
2
{ command: "onGitPush", user_id: user.id }
3
)
4
5
Api.sendMessage({
6
text: "Github webhook: " +
7
"\n<pre>" + url + "</pre>",
8
parse_mode: "html",
9
disable_web_page_preview: true
10
})
11
12
Bot.sendMessage(url);
Copied!
execute /setupGit copy url and go to Github.com > your repository -> Settings -> Webhooks. Press button "Add webhook"
Past copied url as Payload URL
Make like this:
Go to App - create command onGitPush
1
Bot.sendMessage("Start code importing...");
2
3
// Bot.exportGit also possible
4
Bot.importGit({
5
branch: "master", // it is master branch
6
success: "onGitImportCompleted"
7
})
Copied!
command onGitImportCompleted
just put to answer: "Git import completed"
Commands onGitPush and onGitImportCompletedmust be in repository also. Because all commands will be deleted on git importing
Protect onGitPush command if you need this. Anybody can run it.
Copy link
Contents
Setup