Skip to content

Commit

Permalink
Usage instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
rzadp committed Sep 7, 2023
1 parent 665a70d commit 2bd29c1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
11 changes: 10 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67529,8 +67529,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.handleCommand = void 0;
const process_1 = __nccwpck_require__(18442);
const propose_1 = __nccwpck_require__(84095);
const usageInstructions = "See [usage instructions](https://github.com/paritytech/rfc-action#usage).";
const handleCommand = async (opts) => {
const { command, requestState, args } = opts;
if (command?.toLowerCase() === "help") {
return {
success: true,
message: "The RFC action aims to help with the creation of on-chain RFC referenda and with handling the RFC PRs." +
"\n\nThe main commands are `/rfc propose` and `/rfc process`.\n\n" +
usageInstructions,
};
}
if (command?.toLowerCase() === "propose") {
return await (0, propose_1.handleProposeCommand)(requestState);
}
Expand All @@ -67540,7 +67549,7 @@ const handleCommand = async (opts) => {
}
return {
success: false,
errorMessage: "Unrecognized command. Expected one of: `propose`, `process`.",
errorMessage: "Unrecognized command. Expected one of: `help`, `propose`, `process`.\n\n" + usageInstructions,
};
};
exports.handleCommand = handleCommand;
Expand Down
13 changes: 12 additions & 1 deletion src/handle-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ import { handleProcessCommand } from "./process";
import { handleProposeCommand } from "./propose";
import { RequestResult, RequestState } from "./types";

const usageInstructions = "See [usage instructions](https://github.com/paritytech/rfc-action#usage).";

export const handleCommand = async (opts: {
command: string | undefined;
requestState: RequestState;
args: (string | undefined)[];
}): Promise<RequestResult> => {
const { command, requestState, args } = opts;
if (command?.toLowerCase() === "help") {
return {
success: true,
message:
"The RFC action aims to help with the creation of on-chain RFC referenda and with handling the RFC PRs." +
"\n\nThe main commands are `/rfc propose` and `/rfc process`.\n\n" +
usageInstructions,
};
}
if (command?.toLowerCase() === "propose") {
return await handleProposeCommand(requestState);
}
Expand All @@ -17,6 +28,6 @@ export const handleCommand = async (opts: {
}
return {
success: false,
errorMessage: "Unrecognized command. Expected one of: `propose`, `process`.",
errorMessage: "Unrecognized command. Expected one of: `help`, `propose`, `process`.\n\n" + usageInstructions,
};
};

0 comments on commit 2bd29c1

Please sign in to comment.