mirror of
https://github.com/opentofu/setup-opentofu.git
synced 2025-12-31 15:02:19 +00:00
Compare commits
20 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e95ccdd206 | ||
|
|
04ba7507e2 | ||
|
|
720194ca9d | ||
|
|
4738a2ed5e | ||
|
|
bbaf94fb8f | ||
|
|
dc6f440014 | ||
|
|
8ff58c1228 | ||
|
|
339b7b2a1b | ||
|
|
5e2b22fba4 | ||
|
|
dd259403c5 | ||
|
|
5a7ce099f4 | ||
|
|
58cf7f7458 | ||
|
|
1631e5f6a3 | ||
|
|
82a7ffce68 | ||
|
|
9cc1438d52 | ||
|
|
d23989bcfc | ||
|
|
868f16c8cb | ||
|
|
9fc82761c6 | ||
|
|
b16e63e2c6 | ||
|
|
0f0911fca8 |
10 changed files with 56566 additions and 5808 deletions
12
.github/workflows/continuous-integration.yml
vendored
12
.github/workflows/continuous-integration.yml
vendored
|
|
@ -1,19 +1,19 @@
|
||||||
name: 'Continuous Integration'
|
name: "Continuous Integration"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-dist:
|
check-dist:
|
||||||
name: Check dist/ directory
|
name: Check dist/ directory
|
||||||
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@967035ce963867fb956a309c9b67512314bc7c1f
|
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@2826fb8353263a138210fc017301ce5767a9c0d4
|
||||||
with:
|
with:
|
||||||
node-version: "20.x"
|
node-version: "20.19.1"
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@967035ce963867fb956a309c9b67512314bc7c1f
|
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@2826fb8353263a138210fc017301ce5767a9c0d4
|
||||||
with:
|
with:
|
||||||
node-version: "20.x"
|
node-version: "20.19.1"
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,9 @@
|
||||||
# We currently do not have any specific code owners
|
# 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
|
# 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
|
# Later on, we will start splitting up the responsibilities, and packages will be assigned more specific code owners
|
||||||
# * @opentofu-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
|
||||||
|
|
|
||||||
31833
dist/index.js
vendored
31833
dist/index.js
vendored
File diff suppressed because one or more lines are too long
27037
dist/index1.js
vendored
27037
dist/index1.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -28,21 +28,26 @@ class Release {
|
||||||
* @return {Array<Release>} Releases.
|
* @return {Array<Release>} Releases.
|
||||||
*/
|
*/
|
||||||
async function fetchReleases (githubToken) {
|
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 url = 'https://get.opentofu.org/tofu/api.json';
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
Accept: 'application/json'
|
Accept: 'application/json'
|
||||||
};
|
};
|
||||||
|
|
||||||
const resp = await fetch(url, {
|
const resp = await http.get(url, headers);
|
||||||
headers
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!resp.ok) {
|
if (resp.message.statusCode !== hc.HttpCodes.OK) {
|
||||||
throw new Error('failed fetching releases (' + resp.status + ')');
|
throw new Error('failed fetching releases (' + resp.message.statusCode + ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
const releasesMeta = await resp.json();
|
const body = await resp.readBody();
|
||||||
|
const releasesMeta = JSON.parse(body);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Array}
|
* @type {Array}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
3429
package-lock.json
generated
3429
package-lock.json
generated
File diff suppressed because it is too large
Load diff
16
package.json
16
package.json
|
|
@ -19,16 +19,16 @@
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.10.1",
|
"@actions/core": "2.0.1",
|
||||||
"@actions/exec": "1.1.1",
|
"@actions/exec": "2.0.0",
|
||||||
"@actions/io": "1.1.3",
|
"@actions/io": "2.0.0",
|
||||||
"@actions/tool-cache": "2.0.1",
|
"@actions/tool-cache": "2.0.2",
|
||||||
"semver": "7.5.4"
|
"semver": "7.7.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vercel/ncc": "0.38.1",
|
"@vercel/ncc": "0.38.4",
|
||||||
"husky": "9.0.11",
|
"husky": "9.1.7",
|
||||||
"jest": "29.7.0",
|
"jest": "30.2.0",
|
||||||
"semistandard": "17.0.0"
|
"semistandard": "17.0.0"
|
||||||
},
|
},
|
||||||
"semistandard": {
|
"semistandard": {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // Instantiate a new listener
|
* // Instantiate a new listener
|
||||||
* const listener = new OutputListener();
|
* // stream is used to write the data before waiting for the listener to complete
|
||||||
|
* const listener = new OutputListener(stream);
|
||||||
* // Register listener against STDOUT stream
|
* // Register listener against STDOUT stream
|
||||||
* await exec.exec('ls', ['-ltr'], {
|
* await exec.exec('ls', ['-ltr'], {
|
||||||
* listeners: {
|
* listeners: {
|
||||||
|
|
@ -20,12 +21,14 @@
|
||||||
* console.log(listener.contents);
|
* console.log(listener.contents);
|
||||||
*/
|
*/
|
||||||
class OutputListener {
|
class OutputListener {
|
||||||
constructor () {
|
constructor (stream) {
|
||||||
this._buff = [];
|
this._buff = [];
|
||||||
|
this._stream = stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
get listener () {
|
get listener () {
|
||||||
const listen = function listen (data) {
|
const listen = function listen (data) {
|
||||||
|
this._stream.write(data);
|
||||||
this._buff.push(data);
|
this._buff.push(data);
|
||||||
};
|
};
|
||||||
return listen.bind(this);
|
return listen.bind(this);
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const OutputListener = require('../lib/output-listener');
|
const OutputListener = require('../lib/output-listener');
|
||||||
|
const { PassThrough } = require('stream');
|
||||||
describe('output-listener', () => {
|
describe('output-listener', () => {
|
||||||
it('receives and exposes data', () => {
|
it('receives and exposes data', () => {
|
||||||
const listener = new OutputListener();
|
const stream = new PassThrough();
|
||||||
|
const listener = new OutputListener(stream);
|
||||||
const listen = listener.listener;
|
const listen = listener.listener;
|
||||||
listen(Buffer.from('foo'));
|
listen(Buffer.from('foo'));
|
||||||
|
expect(stream.read()).toEqual(Buffer.from('foo'));
|
||||||
listen(Buffer.from('bar'));
|
listen(Buffer.from('bar'));
|
||||||
|
expect(stream.read()).toEqual(Buffer.from('bar'));
|
||||||
listen(Buffer.from('baz'));
|
listen(Buffer.from('baz'));
|
||||||
|
expect(stream.read()).toEqual(Buffer.from('baz'));
|
||||||
expect(listener.contents).toEqual('foobarbaz');
|
expect(listener.contents).toEqual('foobarbaz');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ async function checkTofu () {
|
||||||
await checkTofu();
|
await checkTofu();
|
||||||
|
|
||||||
// Create listeners to receive output (in memory) as well
|
// Create listeners to receive output (in memory) as well
|
||||||
const stdout = new OutputListener();
|
const stdout = new OutputListener(process.stdout);
|
||||||
const stderr = new OutputListener();
|
const stderr = new OutputListener(process.stderr);
|
||||||
const listeners = {
|
const listeners = {
|
||||||
stdout: stdout.listener,
|
stdout: stdout.listener,
|
||||||
stderr: stderr.listener
|
stderr: stderr.listener
|
||||||
|
|
@ -38,10 +38,6 @@ async function checkTofu () {
|
||||||
};
|
};
|
||||||
const exitCode = await exec(pathToCLI, args, options);
|
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
|
// Set outputs, result, exitcode, and stderr
|
||||||
core.setOutput('stdout', stdout.contents);
|
core.setOutput('stdout', stdout.contents);
|
||||||
core.setOutput('stderr', stderr.contents);
|
core.setOutput('stderr', stderr.contents);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue