Skip to content

Commit

Permalink
feat: add config opt alias for bun-config
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Jul 11, 2022
1 parent eb52275 commit 94241b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ inputs:
bun-config:
description: 'Override bunfig.toml file. JSON string as input'
required: false
config:
description: 'bun-config option alias'
required: false

runs:
using: 'node16'
Expand Down
3 changes: 2 additions & 1 deletion src/main/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function readConfig() {
try {
return TOML.parse(fs.readFileSync(configPath, 'utf8'))
} catch (e) {
core.debug('Lockfile not found')
core.info(`bunfig.toml not found: ${configPath}`)
return null
}
}
Expand All @@ -21,6 +21,7 @@ function writeConfig(config) {
const workspace = process.env.GITHUB_WORKSPACE
const configPath = path.join(workspace, CONFIG_NAME)

core.info(`bunfig.toml saved: ${configPath}`)
fs.writeFileSync(configPath, TOML.stringify(JSON.parse(config)))
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function main() {
const repo = core.getInput('bun-repo') || defaultRepo
const platform = core.getInput('platform') || await getPlatform()
const cache = core.getInput('cache')
const config = getConfig(core.getInput('config'))
const config = getConfig(core.getInput('bun-config') || core.getInput('config'))
const version = await pickVersion(repo, range)
const bunInstallPath = await install(repo, version, platform)
const bunBinPath = path.join(bunInstallPath, 'bin')
Expand Down

0 comments on commit 94241b2

Please sign in to comment.