Skip to content

Commit

Permalink
Assign inputs to local vars
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-v committed Sep 22, 2023
1 parent d5dad9c commit fb56d06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ export async function run(): Promise<void> {
// error when trying to cast a string to the enum.
// Per https://thoughtbot.com/blog/the-trouble-with-typescript-enums, what's implemented below
// seems to be the best workaround
const inputReleaseType: string = core.getInput('INPUT_RELEASE_TYPE')

const updateType: VersionReleaseType | undefined = Object.values(
VersionReleaseType
).find(x => x === core.getInput('INPUT_RELEASE_TYPE'))
).find(x => x === inputReleaseType)

if (updateType === undefined) {
throw new Error('Update type is undefined')
Expand All @@ -50,7 +52,8 @@ async function processVersionJson(
updateType: VersionReleaseType
): Promise<void> {
try {
const version: Version = JSON.parse(core.getInput('INPUT_VERSION_JSON'))
const inputVersionJson: string = core.getInput('INPUT_VERSION_JSON')
const version: Version = JSON.parse(inputVersionJson)

// NOTE: for Trading Toolbox, patch and reversion are the same.
switch (updateType) {
Expand Down

0 comments on commit fb56d06

Please sign in to comment.