mirror of
https://github.com/actions-rs/cargo.git
synced 2025-09-04 07:11:57 +03:00
Smarter args parser and a few debug messages
This commit is contained in:
parent
de5e75cc84
commit
40cbaa365c
6 changed files with 27 additions and 15 deletions
|
@ -5,6 +5,8 @@
|
|||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
import stringArgv from 'string-argv';
|
||||
|
||||
// Workaround for a GH bug: https://github.com/actions/toolkit/issues/127
|
||||
//
|
||||
// For input `all-features: true` it will generate the `INPUT_ALL-FEATURES: true`
|
||||
|
@ -41,8 +43,7 @@ export interface Input {
|
|||
|
||||
export function parse(): Input {
|
||||
const command = getInput('command');
|
||||
// TODO: This probably will strike back later
|
||||
const args = getInput('args').split(' ');
|
||||
const args = stringArgv(getInput('args'));
|
||||
let toolchain = getInput('toolchain');
|
||||
if (toolchain.startsWith('+')) {
|
||||
toolchain = toolchain.slice(1);
|
||||
|
|
|
@ -10,12 +10,13 @@ async function getCross(): Promise<string> {
|
|||
try {
|
||||
return await io.which('cross', true);
|
||||
} catch (error) {
|
||||
core.warning('Unable to find cross, installing it now');
|
||||
core.debug('Unable to find cross, installing it now');
|
||||
}
|
||||
|
||||
try {
|
||||
core.startGroup('Install cross');
|
||||
core.warning('Git version of cross will be installed, \
|
||||
see https://github.com/actions-rs/cargo/issues/1');
|
||||
see https://github.com/actions-rs/cargo/issues/1');
|
||||
await exec.exec('cargo', [
|
||||
'install',
|
||||
'--rev',
|
||||
|
@ -25,6 +26,9 @@ async function getCross(): Promise<string> {
|
|||
]);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
throw new Error(error);
|
||||
} finally {
|
||||
core.endGroup();
|
||||
}
|
||||
|
||||
// Expecting it to be in PATH already
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue