chore: remove workaround for setOutput (#374)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
0ca84fc3f8
commit
b508e2e3ef
|
@ -1,35 +0,0 @@
|
||||||
import {beforeEach, describe, expect, it, jest} from '@jest/globals';
|
|
||||||
import * as os from 'os';
|
|
||||||
import * as context from '../src/context';
|
|
||||||
|
|
||||||
describe('setOutput', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
process.stdout.write = jest.fn() as typeof process.stdout.write;
|
|
||||||
});
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/expect-expect
|
|
||||||
it('setOutput produces the correct command', () => {
|
|
||||||
context.setOutput('some output', 'some value');
|
|
||||||
assertWriteCalls([`::set-output name=some output::some value${os.EOL}`]);
|
|
||||||
});
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/expect-expect
|
|
||||||
it('setOutput handles bools', () => {
|
|
||||||
context.setOutput('some output', false);
|
|
||||||
assertWriteCalls([`::set-output name=some output::false${os.EOL}`]);
|
|
||||||
});
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/expect-expect
|
|
||||||
it('setOutput handles numbers', () => {
|
|
||||||
context.setOutput('some output', 1.01);
|
|
||||||
assertWriteCalls([`::set-output name=some output::1.01${os.EOL}`]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Assert that process.stdout.write calls called only with the given arguments.
|
|
||||||
function assertWriteCalls(calls: string[]): void {
|
|
||||||
expect(process.stdout.write).toHaveBeenCalledTimes(calls.length);
|
|
||||||
for (let i = 0; i < calls.length; i++) {
|
|
||||||
expect(process.stdout.write).toHaveBeenNthCalledWith(i + 1, calls[i]);
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,5 @@
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import {issueCommand} from '@actions/core/lib/command';
|
|
||||||
|
|
||||||
export const osPlat: string = os.platform();
|
export const osPlat: string = os.platform();
|
||||||
export const osArch: string = os.arch();
|
export const osArch: string = os.arch();
|
||||||
|
@ -22,8 +21,3 @@ export async function getInputs(): Promise<Inputs> {
|
||||||
installOnly: core.getBooleanInput('install-only')
|
installOnly: core.getBooleanInput('install-only')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Temp fix https://github.com/actions/toolkit/issues/777
|
|
||||||
export function setOutput(name: string, value: unknown): void {
|
|
||||||
issueCommand('set-output', {name}, value);
|
|
||||||
}
|
|
||||||
|
|
|
@ -69,14 +69,14 @@ async function run(): Promise<void> {
|
||||||
if (artifacts) {
|
if (artifacts) {
|
||||||
await core.group(`Artifacts output`, async () => {
|
await core.group(`Artifacts output`, async () => {
|
||||||
core.info(artifacts);
|
core.info(artifacts);
|
||||||
context.setOutput('artifacts', artifacts);
|
core.setOutput('artifacts', artifacts);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const metadata = await goreleaser.getMetadata(await goreleaser.getDistPath(yamlfile));
|
const metadata = await goreleaser.getMetadata(await goreleaser.getDistPath(yamlfile));
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
await core.group(`Metadata output`, async () => {
|
await core.group(`Metadata output`, async () => {
|
||||||
core.info(metadata);
|
core.info(metadata);
|
||||||
context.setOutput('metadata', metadata);
|
core.setOutput('metadata', metadata);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue