diff --git a/dist/index.js b/dist/index.js index 1466872..0839809 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2202,14 +2202,14 @@ const inputDefaults = { // entry point when this action is run on its own async function run() { try { - await setupRuby({}) + await setupRuby() } catch (error) { core.setFailed(error.message) } } // entry point when this action is run from other actions -async function setupRuby(options) { +async function setupRuby(options = {}) { const inputs = { ...options } for (const key in inputDefaults) { if (!inputs.hasOwnProperty(key)) { @@ -2238,6 +2238,13 @@ async function setupRuby(options) { setupPath(newPathEntries) + // When setup-ruby is used by other actions, this allows code in them to run + // before 'bundle install'. Installed dependencies may require additional + // libraries & headers, build tools, etc. + if (inputs['afterSetupPathHook'] instanceof Function) { + await inputs['afterSetupPathHook']({ platform, rubyPrefix, engine, version }) + } + if (inputs['bundler'] !== 'none') { await common.measure('Installing Bundler', async () => installBundler(inputs['bundler'], platform, rubyPrefix, engine, version)) diff --git a/index.js b/index.js index 11c1c34..4fbaa81 100644 --- a/index.js +++ b/index.js @@ -16,14 +16,14 @@ const inputDefaults = { // entry point when this action is run on its own export async function run() { try { - await setupRuby({}) + await setupRuby() } catch (error) { core.setFailed(error.message) } } // entry point when this action is run from other actions -export async function setupRuby(options) { +export async function setupRuby(options = {}) { const inputs = { ...options } for (const key in inputDefaults) { if (!inputs.hasOwnProperty(key)) { @@ -52,6 +52,13 @@ export async function setupRuby(options) { setupPath(newPathEntries) + // When setup-ruby is used by other actions, this allows code in them to run + // before 'bundle install'. Installed dependencies may require additional + // libraries & headers, build tools, etc. + if (inputs['afterSetupPathHook'] instanceof Function) { + await inputs['afterSetupPathHook']({ platform, rubyPrefix, engine, version }) + } + if (inputs['bundler'] !== 'none') { await common.measure('Installing Bundler', async () => installBundler(inputs['bundler'], platform, rubyPrefix, engine, version))