Update Node.js runtime to 24 (#91)

Signed-off-by: Dawid Jóźwiak <5508474+Operativ@users.noreply.github.com>
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
Co-authored-by: Dawid Jóźwiak <5508474+Operativ@users.noreply.github.com>
Co-authored-by: Diogenes Fernandes <diofeher@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-03-12 09:19:16 +00:00
1 parent 9d84900f32
commit fc711fa910
19 files changed
+44738 -43700

No files matched your search

+3 -6
View File
@@ -1,5 +1,6 @@
/**
* Copyright (c) HashiCorp, Inc.
* Copyright (c) OpenTofu
* SPDX-License-Identifier: MPL-2.0
*/
@@ -20,7 +21,7 @@
* // Log out STDOUT contents
* console.log(listener.contents);
*/
class OutputListener {
export default class OutputListener {
constructor (stream) {
this._buff = [];
this._stream = stream;
@@ -35,10 +36,6 @@ class OutputListener {
}
get contents () {
return this._buff
.map(chunk => chunk.toString())
.join('');
return this._buff.map((chunk) => chunk.toString()).join('');
}
}
module.exports = OutputListener;
+6 -3
View File
@@ -1,14 +1,17 @@
/**
* Copyright (c) HashiCorp, Inc.
* Copyright (c) OpenTofu
* SPDX-License-Identifier: MPL-2.0
*/
const os = require('os');
const path = require('path');
import os from 'os';
import path from 'path';
module.exports = (() => {
const tofuBin = (() => {
// If we're on Windows, then the executable ends with .exe
const exeSuffix = os.platform().startsWith('win') ? '.exe' : '';
return [process.env.TOFU_CLI_PATH, `tofu-bin${exeSuffix}`].join(path.sep);
})();
export default tofuBin;
+4 -2
View File
@@ -1,10 +1,12 @@
/**
* Copyright (c) HashiCorp, Inc.
* Copyright (c) OpenTofu
* SPDX-License-Identifier: MPL-2.0
*/
const OutputListener = require('../lib/output-listener');
const { PassThrough } = require('stream');
import OutputListener from '../lib/output-listener.js';
import { PassThrough } from 'stream';
describe('output-listener', () => {
it('receives and exposes data', () => {
const stream = new PassThrough();
+11 -10
View File
@@ -1,20 +1,21 @@
#!/usr/bin/env node
/**
* Copyright (c) HashiCorp, Inc.
* Copyright (c) OpenTofu
* SPDX-License-Identifier: MPL-2.0
*/
const io = require('@actions/io');
const core = require('@actions/core');
const { exec } = require('@actions/exec');
import { which } from '@actions/io';
import { setOutput, setFailed } from '@actions/core';
import { exec } from '@actions/exec';
const OutputListener = require('./lib/output-listener');
const pathToCLI = require('./lib/tofu-bin');
import OutputListener from './lib/output-listener.js';
import pathToCLI from './lib/tofu-bin.js';
async function checkTofu () {
// Setting check to `true` will cause `which` to throw if tofu isn't found
const check = true;
return io.which(pathToCLI, check);
return which(pathToCLI, check);
}
(async () => {
@@ -39,9 +40,9 @@ async function checkTofu () {
const exitCode = await exec(pathToCLI, args, options);
// Set outputs, result, exitcode, and stderr
core.setOutput('stdout', stdout.contents);
core.setOutput('stderr', stderr.contents);
core.setOutput('exitcode', exitCode.toString(10));
setOutput('stdout', stdout.contents);
setOutput('stderr', stderr.contents);
setOutput('exitcode', exitCode.toString(10));
if (exitCode === 0 || exitCode === 2) {
// A exitCode of 0 is considered a success
@@ -52,5 +53,5 @@ async function checkTofu () {
}
// A non-zero exitCode is considered an error
core.setFailed(`OpenTofu exited with code ${exitCode}.`);
setFailed(`OpenTofu exited with code ${exitCode}.`);
})();