diff --git a/dist/index.js b/dist/index.js index 286ff18..a5ab974 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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); } @@ -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; diff --git a/src/handle-command.ts b/src/handle-command.ts index 4f97689..c1ca7b4 100644 --- a/src/handle-command.ts +++ b/src/handle-command.ts @@ -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 => { 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); } @@ -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, }; };