Skip to content

Commit

Permalink
Merge branch 'deprecated'
Browse files Browse the repository at this point in the history
* deprecated:
  Move installer to relevant action
  Ensure errors are caught
  node-version now depends on setup-node directly
  Remove old action manifest
  • Loading branch information
jasonkarns committed Mar 18, 2020
2 parents 66ff0c5 + 8bf2b61 commit 8180273
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 32 deletions.
19 changes: 0 additions & 19 deletions action.yml

This file was deleted.

12 changes: 6 additions & 6 deletions node-version/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const exec = require('util').promisify(require('child_process').exec)
const core = require('@actions/core')

const { installNodenv } = require('../src/installer')
const setupNodenv = require('../setup-nodenv')
const { fail } = require('../src/utils')

async function run () {
return Promise.resolve()
.then(() => installNodenv(core.getInput('nodenv-version')))
function run () {
return setupNodenv
.then(() => exec('nodenv local'))
.then(cmd => core.setOutput('node-version', cmd.stdout.trim()))
.catch(error => core.setFailed(error.message))
}

run()
module.exports = run()
module.exports.catch(fail)
14 changes: 8 additions & 6 deletions setup-nodenv/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const core = require('@actions/core')
const { installNodenv } = require('../src/installer')
const { installNodenv } = require('.installer')
const { fail } = require('../src/utils')

async function run () {
return Promise.resolve()
.then(() => installNodenv(core.getInput('nodenv-version')))
.catch(error => core.setFailed(error.message))
function run () {
return Promise.resolve().then(() =>
installNodenv(core.getInput('nodenv-version'))
)
}

run()
module.exports = run()
module.exports.catch(fail)
File renamed without changes.
7 changes: 7 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const core = require('@actions/core')

module.exports = {
fail (error) {
core.setFailed(error.message)
}
}
2 changes: 1 addition & 1 deletion test/lib/installer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const existsSync = require('fs').existsSync
process.env.RUNNER_TOOL_CACHE = path.join(__dirname, '../runner/tools')
process.env.RUNNER_TEMP = path.join(__dirname, '../runner/temp')

const installNodenv = require('../../src/installer').installNodenv
const installNodenv = require('../../setup-nodenv/installer').installNodenv

describe('installer tests', () => {
beforeAll(async () => {
Expand Down

0 comments on commit 8180273

Please sign in to comment.