mirror of
https://github.com/jlengrand/github-project.git
synced 2026-03-10 08:21:20 +00:00
Creating test code for Github
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,3 +5,4 @@ package-lock.json
|
||||
yarn.lock
|
||||
.firebase
|
||||
*.log
|
||||
.env
|
||||
@@ -1,4 +1,5 @@
|
||||
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://github.com/octokit/core.js#readme
|
||||
https://actions-on-google.github.io/assistant-conversation-nodejs/3.0.0/index.html
|
||||
@@ -1 +1 @@
|
||||
transitionToScene: Start
|
||||
transitionToScene: GithubStart
|
||||
|
||||
19
sdk/custom/scenes/GithubStart.yaml
Normal file
19
sdk/custom/scenes/GithubStart.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
conditionalEvents:
|
||||
- condition: scene.slots.status == "FINAL"
|
||||
handler:
|
||||
webhookHandler: create_github_repository
|
||||
onEnter:
|
||||
staticPrompt:
|
||||
candidates:
|
||||
- promptResponse:
|
||||
firstSimple:
|
||||
variants:
|
||||
- speech: Seems like you want to create a repository. What name would you
|
||||
like to use?
|
||||
slots:
|
||||
- commitBehavior:
|
||||
writeSessionParam: project_name_slot
|
||||
name: project_name_slot
|
||||
required: true
|
||||
type:
|
||||
name: project_name
|
||||
1
sdk/custom/scenes/caca.yaml
Normal file
1
sdk/custom/scenes/caca.yaml
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
sdk/custom/types/project_name.yaml
Normal file
1
sdk/custom/types/project_name.yaml
Normal file
@@ -0,0 +1 @@
|
||||
freeText: {}
|
||||
@@ -1,4 +1,5 @@
|
||||
handlers:
|
||||
- name: start_scene_initial_prompt
|
||||
- name: create_github_repository
|
||||
inlineCloudFunction:
|
||||
executeFunction: ActionsOnGoogleFulfillment
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/**
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const {conversation} = require('@assistant/conversation');
|
||||
const functions = require('firebase-functions');
|
||||
|
||||
@@ -26,4 +10,12 @@ app.handle('start_scene_initial_prompt', (conv) => {
|
||||
conv.add('Hello world from fulfillment');
|
||||
});
|
||||
|
||||
app.handle('create_github_repository', (conv) => {
|
||||
console.log('Start scene: create_github_repository');
|
||||
conv.overwrite = false;
|
||||
conv.scene.next.name = 'actions.scene.END_CONVERSATION';
|
||||
conv.add('Hello world from ' + conv.scene.slots.project_name_slot.value);
|
||||
console.log(conv.scene.slots.project_name_slot.value);
|
||||
});
|
||||
|
||||
exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@assistant/conversation": "^3.0.0",
|
||||
"@octokit/core": "^3.1.1",
|
||||
"firebase-admin": "~8.12.1",
|
||||
"firebase-functions": "^3.6.2"
|
||||
},
|
||||
|
||||
16
sdk/webhooks/ActionsOnGoogleFulfillment/test.js
Normal file
16
sdk/webhooks/ActionsOnGoogleFulfillment/test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const { request } = require("@octokit/request");
|
||||
const { Octokit } = require("@octokit/core");
|
||||
|
||||
const octokit = new Octokit({ auth: `test` });
|
||||
|
||||
|
||||
const start = async function(){
|
||||
const response = await octokit.request("GET /users/:username/repos", {
|
||||
username: "jlengrand",
|
||||
});
|
||||
|
||||
console.log(`${response.data.length} repos found.`);
|
||||
console.log(`${response.data[0]}`);
|
||||
}
|
||||
|
||||
start();
|
||||
Reference in New Issue
Block a user