Compare commits

..

No commits in common. "main" and "v1" have entirely different histories.
main ... v1

10 changed files with 5480 additions and 56238 deletions

View file

@ -1,19 +1,19 @@
name: "Continuous Integration"
name: 'Continuous Integration'
on:
push:
branches:
- main
- main
pull_request:
jobs:
check-dist:
name: Check dist/ directory
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@2826fb8353263a138210fc017301ce5767a9c0d4
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@967035ce963867fb956a309c9b67512314bc7c1f
with:
node-version: "20.19.1"
node-version: "20.x"
test:
name: Test
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@2826fb8353263a138210fc017301ce5767a9c0d4
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@967035ce963867fb956a309c9b67512314bc7c1f
with:
node-version: "20.19.1"
node-version: "20.x"

View file

@ -4,9 +4,4 @@
# We currently do not have any specific code owners
# In the future, we will have a Github team of global code owners of the entire package
# Later on, we will start splitting up the responsibilities, and packages will be assigned more specific code owners
* @opentofu/maintainers
# The last matching pattern takes the most precedence for CODEOWNERS. CODEOWNERS does not have fine-grained control so we will
# just match whole changes for these specific files, but @diofeher is responsible for taking care of the Dependabot updates
# in this repository.
package*.json @diofeher
# * @opentofu-code-owners

31603
dist/index.js vendored

File diff suppressed because one or more lines are too long

26807
dist/index1.js vendored

File diff suppressed because one or more lines are too long

View file

@ -28,26 +28,21 @@ class Release {
* @return {Array<Release>} Releases.
*/
async function fetchReleases (githubToken) {
const hc = require('@actions/http-client');
const userAgent = 'opentofu/setup-opentofu';
const http = new hc.HttpClient(userAgent);
const url = 'https://get.opentofu.org/tofu/api.json';
const headers = {
Accept: 'application/json'
};
const resp = await http.get(url, headers);
const resp = await fetch(url, {
headers
});
if (resp.message.statusCode !== hc.HttpCodes.OK) {
throw new Error('failed fetching releases (' + resp.message.statusCode + ')');
if (!resp.ok) {
throw new Error('failed fetching releases (' + resp.status + ')');
}
const body = await resp.readBody();
const releasesMeta = JSON.parse(body);
const releasesMeta = await resp.json();
/**
* @type {Array}
*/

3233
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -19,16 +19,16 @@
"keywords": [],
"author": "",
"dependencies": {
"@actions/core": "2.0.1",
"@actions/exec": "2.0.0",
"@actions/io": "2.0.0",
"@actions/tool-cache": "2.0.2",
"semver": "7.7.3"
"@actions/core": "1.10.1",
"@actions/exec": "1.1.1",
"@actions/io": "1.1.3",
"@actions/tool-cache": "2.0.1",
"semver": "7.5.4"
},
"devDependencies": {
"@vercel/ncc": "0.38.4",
"husky": "9.1.7",
"jest": "30.2.0",
"@vercel/ncc": "0.38.1",
"husky": "9.0.11",
"jest": "29.7.0",
"semistandard": "17.0.0"
},
"semistandard": {

View file

@ -9,8 +9,7 @@
*
* @example
* // Instantiate a new listener
* // stream is used to write the data before waiting for the listener to complete
* const listener = new OutputListener(stream);
* const listener = new OutputListener();
* // Register listener against STDOUT stream
* await exec.exec('ls', ['-ltr'], {
* listeners: {
@ -21,14 +20,12 @@
* console.log(listener.contents);
*/
class OutputListener {
constructor (stream) {
constructor () {
this._buff = [];
this._stream = stream;
}
get listener () {
const listen = function listen (data) {
this._stream.write(data);
this._buff.push(data);
};
return listen.bind(this);

View file

@ -4,18 +4,14 @@
*/
const OutputListener = require('../lib/output-listener');
const { PassThrough } = require('stream');
describe('output-listener', () => {
it('receives and exposes data', () => {
const stream = new PassThrough();
const listener = new OutputListener(stream);
const listener = new OutputListener();
const listen = listener.listener;
listen(Buffer.from('foo'));
expect(stream.read()).toEqual(Buffer.from('foo'));
listen(Buffer.from('bar'));
expect(stream.read()).toEqual(Buffer.from('bar'));
listen(Buffer.from('baz'));
expect(stream.read()).toEqual(Buffer.from('baz'));
expect(listener.contents).toEqual('foobarbaz');
});
});

View file

@ -22,8 +22,8 @@ async function checkTofu () {
await checkTofu();
// Create listeners to receive output (in memory) as well
const stdout = new OutputListener(process.stdout);
const stderr = new OutputListener(process.stderr);
const stdout = new OutputListener();
const stderr = new OutputListener();
const listeners = {
stdout: stdout.listener,
stderr: stderr.listener
@ -38,6 +38,10 @@ async function checkTofu () {
};
const exitCode = await exec(pathToCLI, args, options);
// Pass-through stdout/err as `exec` won't due to `silent: true` option
process.stdout.write(stdout.contents);
process.stderr.write(stderr.contents);
// Set outputs, result, exitcode, and stderr
core.setOutput('stdout', stdout.contents);
core.setOutput('stderr', stderr.contents);