Creates minimal github integration

This commit is contained in:
Julien Lengrand-Lambert
2020-07-30 23:38:15 +02:00
parent 5b986a0916
commit 4b19081768
2 changed files with 50 additions and 9 deletions

View File

@@ -1,5 +1,17 @@
https://github.com/actions-on-google/actions-builder-hello-world-nodejs
https://console.actions.google.com/u/0/project/github-project-321e8/settings/general
https://developers.google.com/assistant/actionssdk/gactions
https://github.com/octokit/core.js#readme
https://actions-on-google.github.io/assistant-conversation-nodejs/3.0.0/index.html
* https://github.com/actions-on-google/actions-builder-hello-world-nodejs
* https://console.actions.google.com/u/0/project/github-project-321e8/settings/general
* https://developers.google.com/assistant/actionssdk/gactions
* https://github.com/octokit/core.js#readme
* https://actions-on-google.github.io/assistant-conversation-nodejs/3.0.0/index.html
* https://github.com/actions-on-google/assistant-conversation-nodejs/blob/master/src/api/schema.ts
* https://console.firebase.google.com/u/0/project/github-project-321e8/functions/logs?search=labels.execution_id%20%3D%20%22f9oir517vv00%22&severity=DEBUG&
* https://console.actions.google.com/u/0/project/github-project-321e8/simulator?disableAutoPreview
* https://medium.com/@alkeshsrivastava11/speed-up-actions-on-google-development-workflow-with-local-fulfilment-7de17d5f166f
* https://developers.google.com/assistant/conversational/actions
* https://github.com/boyney123/awesome-github-templates
* Spring Boot : https://github.com/Spring-Boot-Framework/Spring-Boot-Application-Template
* Typescript : https://github.com/carsonfarmer/ts-template

View File

@@ -3,14 +3,43 @@ const { Octokit } = require("@octokit/core");
const octokit = new Octokit({ auth: `test` });
const sanitize = function(repoName){
return repoName.split(' ').join('_');
}
const start = async function(){
const response = await octokit.request("GET /users/:username/repos", {
username: "jlengrand",
const createJavaRepoFromTemplate = createRepoFromTemplate(sanitizedRepoName, "Spring-Boot-Framework", "Spring-Boot-Application-Template");
const createTypescriptRepoFromTemplate = createRepoFromTemplate(sanitizedRepoName, "carsonfarmer", "ts-template");
const createRepoFromTemplate = async function(sanitizedRepoName, templateOwner, templateRepo){
const response = await octokit.request("POST /repos/:template_owner/:template_repo/generate", {
template_owner: templateOwner,
template_repo: templateRepo,
name: sanitizedRepoName,
mediaType: {
previews: ["baptiste-preview"],
},
});
console.log(`${response.data.length} repos found.`);
console.log(`${response.data[0]}`);
}
start();
const listRepos = async function(){
const response = await octokit.request("GET /users/:username/repos", {
username: "jlengrand",
mediaType: {
previews: ["baptiste"],
},
});
console.log(`${response.data.length} repos found.`);
console.log(`${response.data[0]}`);
}
const createFromTemplate = async function(repoName){
const response = await createJavaRepoFromTemplate(sanitize(repoName));
console.log(`${response}`);
}
// start();
createFromTemplate("a test repo");