diff --git a/api/controllers/v1/slack.ts b/api/controllers/v1/slack.ts index 3b2f71864..117e8a3db 100644 --- a/api/controllers/v1/slack.ts +++ b/api/controllers/v1/slack.ts @@ -50,7 +50,7 @@ export const DisplayRepoOptions = async (event: APIGatewayEvent): Promise - branchTwo.text.text - .toString() - .replace(/\d+/g, (n) => +n + 100000) - .localeCompare(branchOne.text.text.toString().replace(/\d+/g, (n) => +n + 100000)) - ), - }; - repoOptions.push(repoOption); + const repoOption = { + label: { + type: 'plain_text', + text: repoName, + }, + //sort the options by version number + options: options.sort((branchOne, branchTwo) => + branchTwo.text.text + .toString() + .replace(/\d+/g, (n) => +n + 100000) + .localeCompare(branchOne.text.text.toString().replace(/\d+/g, (n) => +n + 100000)) + ), + }; + repoOptions.push(repoOption); + } } return repoOptions.sort((repoOne, repoTwo) => repoOne.label.text.localeCompare(repoTwo.label.text)); }