Skip to content

Commit

Permalink
explicitly read from the home directory
Browse files Browse the repository at this point in the history
  • Loading branch information
gjedlicska committed Aug 11, 2023
1 parent 3523652 commit 4599eff
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 28 deletions.
2 changes: 1 addition & 1 deletion dist/action/37.index.js

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

53 changes: 28 additions & 25 deletions dist/action/index.js

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

2 changes: 1 addition & 1 deletion dist/action/index.js.map

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { z } from 'zod'
import fetch from 'node-fetch'
import { retry } from '@lifeomic/attempt'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'

const InputVariablesSchema = z.object({
speckleAutomateUrl: z.string().url().nonempty(),
Expand All @@ -21,8 +22,11 @@ const parseInputs = (): InputVariables => {
let speckleFunctionInputSchema: Record<string, unknown> | null = null
try {
const rawInputSchemaPath = core.getInput('speckle_function_input_schema_file_path')
const homeDir = process.env['HOME']
if (!homeDir)
throw new Error('The home directory is not defined, cannot load inputSchema')
if (rawInputSchemaPath) {
const rawInputSchema = readFileSync(rawInputSchemaPath, 'utf-8')
const rawInputSchema = readFileSync(join(homeDir, rawInputSchemaPath), 'utf-8')
speckleFunctionInputSchema = JSON.parse(rawInputSchema)
}
} catch (err) {
Expand Down

0 comments on commit 4599eff

Please sign in to comment.