Update shebang from wrapper to use the node version that action is running

This commit is contained in:
Gerard Ribugent 2026-01-22 14:29:50 +01:00
parent b9cd54a3c3
commit 963824662d
No known key found for this signature in database
GPG key ID: DCD0E41D4DDD2F80

View file

@ -81,8 +81,13 @@ async function installWrapper (pathToCLI) {
try {
source = path.resolve([__dirname, '..', 'wrapper', 'dist', 'index.js'].join(path.sep));
target = [pathToCLI, 'terraform'].join(path.sep);
core.debug(`Copying ${source} to ${target}.`);
await io.cp(source, target);
core.debug(`Reading wrapper from ${source} and updating shebang.`);
const wrapperContent = (await fs.readFile(source, 'utf8')).split('\n');
wrapperContent[0] = `#!${process.argv[0]}`;
core.debug(`Writing updated wrapper to ${target}.`);
await fs.writeFile(target, wrapperContent.join('\n'));
} catch (e) {
core.error(`Unable to copy ${source} to ${target}.`);
throw e;