From 2b0992a0eceb5139a48c8bdcf8c9d279d12c8d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Ch=C3=A1nh=20=C4=90=E1=BA=A1i?= Date: Tue, 20 Feb 2024 20:34:32 +0700 Subject: [PATCH] Add configure orientation for devcard --- action.yml | 2 +- src/index.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 04d4c4a..38ed43a 100644 --- a/action.yml +++ b/action.yml @@ -10,7 +10,7 @@ inputs: required: true type: - description: "Configure orientation for devcard" + description: 'Configure orientation for devcard. Must be either "default" or "wide"' default: default required: false diff --git a/src/index.ts b/src/index.ts index ed4560e..45e1f98 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,6 +33,11 @@ const devcardURL = (user_id: string, type = 'default'): string => throw new Error('Filename is required') } + // throw an error if type is invalid, must be either "default" or "wide" + if (type && !['default', 'wide'].includes(type)) { + throw new Error('Invalid type. Must be either "default" or "wide"') + } + console.log(`Dryrun`, dryrun) // Fetch the latest devcard