Skip to content

Commit

Permalink
chore: sorting commands
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Jul 10, 2024
1 parent 798f58b commit 83e6e14
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/github/handlers/issue-comment-created.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@ export default async function issueCommentCreated(context: GitHubContext<"issue_
"|---|---|---|",
"| `/help` | List all available commands. | `/help` |",
];
const commands: string[] = [];
const configuration = await getConfig(context);
for (const pluginArray of Object.values(configuration.plugins)) {
for (const pluginElement of pluginArray) {
const { plugin } = pluginElement.uses[0];
const manifest = await (isGithubPlugin(plugin) ? fetchActionManifest(context, plugin) : fetchWorkerManifest(plugin));
if (manifest?.commands) {
for (const command of manifest.commands) {
comments.push(`| \`${getContent(command.command)}\` | ${getContent(command.description)} | \`${getContent(command.example)}\` |`);
commands.push(`| \`${getContent(command.command)}\` | ${getContent(command.description)} | \`${getContent(command.example)}\` |`);
}
}
}
}
await context.octokit.issues.createComment({
body: comments.sort().join("\n"),
body: comments.concat(commands.sort()).join("\n"),
issue_number: context.payload.issue.number,
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
Expand Down

0 comments on commit 83e6e14

Please sign in to comment.