我最近开始使用 github 操作,我想使用 github-cli 进行操作,我一直在学习有关如何手动运行工作流的教程:https://cli.github.com/manual/gh_workflow_run
好吧,在我的机器上,我得到以下信息:
.github/workflows (git)-[windows_workflow] % gh workflow run
unknown command "run" for "gh workflow"
Usage: gh workflow <command> [flags]
Available commands:
想法?我正在关注 API 并且我有一个最新版本的 github-cli:
gh version 1.8.1 (2021-04-03)
https://github.com/cli/cli/releases/tag/v1.8.1
答案 0 :(得分:1)
"use strict";
const Bell = require("@hapi/bell");
const Hapi = require("@hapi/hapi");
const Cookie = require("@hapi/cookie");
const init = async () => {
const server = Hapi.server({
port: 3000,
host: "localhost",
routes: { cors: { origin: ["*"] } },
});
let plugins = [
{
plugin: Bell,
},
{
plugin: Cookie,
},
];
await server.register(plugins);
server.auth.strategy("session", "cookie", {
cookie: {
name: "sid-example",
// Don't forget to change it to your own secret password!
password: "this-is-a-32-character-password",
// For working via HTTP in localhost
isSecure: false,
},
});
server.auth.strategy("google", "bell", {
provider: "google",
password: "this-is-a-32-character-password",
isSecure: false,
clientId: "google-client-id",
clientSecret: "google-client-secret",
//location: server.info.uri,
//location: "http://localhost:3000/auth/google",
scope(request) {
return ["profile", "email"];
},
});
server.auth.default("google");
server.route({
method: "GET",
path: "/auth/google",
options: {
auth: {
strategy: "google",
mode: "required",
},
handler: function (request, h) {
if (!request.auth.isAuthenticated) {
return "Authentication failed due to: " + request.auth.error.message;
} else {
let creds = request.auth.credentials;
request.cookieAuth.set({
token: creds.token,
email: creds.profile.email,
});
}
return (
"<pre> response = " +
JSON.stringify(request.auth.credentials, null, 4) +
"</pre>"
);
},
},
});
server.route({
method: "GET",
path: "/logout",
handler: (request, h) => {
return "<pre> logged out successfully </pre>";
},
config: {
auth: {
mode: "required",
strategy: "session",
},
},
});
await server.start();
console.log("Server running on %s", server.info.uri);
};
process.on("unhandledRejection", (err) => {
console.log(err);
process.exit(1);
});
init();
已添加到 gh v1.9.0,您使用的是 v1.8.1。